From daa2748325c1fc05c99174e6e6894144fc895eeb Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Sat, 23 Aug 2014 13:54:22 -0700 Subject: remove instance ref via helper method --- lib/chef/api_client/registration.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/chef/api_client/registration.rb b/lib/chef/api_client/registration.rb index d2596c321b..5ec0ce82a8 100644 --- a/lib/chef/api_client/registration.rb +++ b/lib/chef/api_client/registration.rb @@ -56,7 +56,7 @@ class Chef assert_destination_writable! retries = Config[:client_registration_retries] || 5 begin - @update ? create_or_update : create + should_update? ? create_or_update : create rescue Net::HTTPFatalError => e # HTTPFatalError implies 5xx. raise if retries <= 0 @@ -158,6 +158,12 @@ class Chef base_flags |= File::NOFOLLOW if defined?(File::NOFOLLOW) base_flags end + + private + + def should_update? + !!@update + end end end end -- cgit v1.2.1