summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/resource/macos_userdefaults.rb43
1 files changed, 23 insertions, 20 deletions
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb
index b0b9c32fe0..ee84278392 100644
--- a/lib/chef/resource/macos_userdefaults.rb
+++ b/lib/chef/resource/macos_userdefaults.rb
@@ -17,7 +17,6 @@
require_relative "../resource"
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
-require "corefoundation" if RUBY_PLATFORM.match?(/darwin/)
autoload :Plist, "plist"
class Chef
@@ -136,27 +135,31 @@ class Chef
CF::Preferences.get(new_resource.key, new_resource.domain, new_resource.user, new_resource.host)
end
- # Return valid hostname based on the input from host property
- def to_cf_host(value)
- case value
- when :all
- CF::Preferences::ALL_HOSTS
- when :current
- CF::Preferences::CURRENT_HOST
- else
- value
+ action_class do
+ require "corefoundation" if RUBY_PLATFORM.match?(/darwin/)
+
+ # Return valid hostname based on the input from host property
+ def to_cf_host(value)
+ case value
+ when :all
+ CF::Preferences::ALL_HOSTS
+ when :current
+ CF::Preferences::CURRENT_HOST
+ else
+ value
+ end
end
- end
- # Return valid username based on the input from user property
- def to_cf_user(value)
- case value
- when :all
- CF::Preferences::ALL_USERS
- when :current
- CF::Preferences::CURRENT_USER
- else
- value
+ # Return valid username based on the input from user property
+ def to_cf_user(value)
+ case value
+ when :all
+ CF::Preferences::ALL_USERS
+ when :current
+ CF::Preferences::CURRENT_USER
+ else
+ value
+ end
end
end
end