diff options
author | Gregory Batye <gbatye@fb.com> | 2017-02-17 09:22:38 -0800 |
---|---|---|
committer | Gregory Batye <gbatye@fb.com> | 2017-02-17 09:23:09 -0800 |
commit | 934d4e09c9462e3339c6132ea7970369b7bb0cdc (patch) | |
tree | c74f038bc3522cd362ec0d28c12ae09dbedbdf21 /lib/chef/provider/osx_profile.rb | |
parent | c0f2f0e22d6bd8c14e39dc8950a751fccaa30910 (diff) | |
parent | a048bda66fa719607b85af72bceb79136fe2fe57 (diff) | |
download | chef-934d4e09c9462e3339c6132ea7970369b7bb0cdc.tar.gz |
Merge remote-tracking branch 'chef/master' into fix_osx_profile
Signed-off-by: Gregory Batye <gbatye@fb.com>
Diffstat (limited to 'lib/chef/provider/osx_profile.rb')
-rw-r--r-- | lib/chef/provider/osx_profile.rb | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb index 6939c386a1..9a3b0f9b4a 100644 --- a/lib/chef/provider/osx_profile.rb +++ b/lib/chef/provider/osx_profile.rb @@ -34,16 +34,16 @@ class Chef end def load_current_resource - @current_resource = Chef::Resource::OsxProfile.new(@new_resource.name) - @current_resource.profile_name(@new_resource.profile_name) + @current_resource = Chef::Resource::OsxProfile.new(new_resource.name) + current_resource.profile_name(new_resource.profile_name) all_profiles = get_installed_profiles - @new_resource.profile( - @new_resource.profile || - @new_resource.profile_name + new_resource.profile( + new_resource.profile || + new_resource.profile_name ) - @new_profile_hash = get_profile_hash(@new_resource.profile) + @new_profile_hash = get_profile_hash(new_resource.profile) if @new_profile_hash @new_profile_hash["PayloadUUID"] = config_uuid(@new_profile_hash) @@ -52,8 +52,8 @@ class Chef if @new_profile_hash @new_profile_identifier = @new_profile_hash["PayloadIdentifier"] else - @new_profile_identifier = @new_resource.identifier || - @new_resource.profile_name + @new_profile_identifier = new_resource.identifier || + new_resource.profile_name end current_profile = nil @@ -62,7 +62,7 @@ class Chef item["ProfileIdentifier"] == @new_profile_identifier end end - @current_resource.profile(current_profile) + current_resource.profile(current_profile) end def define_resource_requirements @@ -75,7 +75,7 @@ class Chef end a.failure_message RuntimeError, "when removing using the identifier attribute, it must match the profile identifier" else - new_profile_name = @new_resource.profile_name + new_profile_name = new_resource.profile_name a.assertion do !new_profile_name.end_with?(".mobileconfig") && /^\w+(?:(\.| )\w+)+$/.match(new_profile_name) @@ -136,13 +136,13 @@ class Chef def cookbook_file_available?(cookbook_file) run_context.has_cookbook_file_in_cookbook?( - @new_resource.cookbook_name, cookbook_file + new_resource.cookbook_name, cookbook_file ) end def get_cache_dir cache_dir = Chef::FileCache.create_cache_path( - "profiles/#{@new_resource.cookbook_name}" + "profiles/#{new_resource.cookbook_name}" ) end @@ -150,7 +150,7 @@ class Chef Chef::FileCache.create_cache_path( ::File.join( "profiles", - @new_resource.cookbook_name, + new_resource.cookbook_name, ::File.dirname(cookbook_file) ) ) @@ -161,7 +161,7 @@ class Chef ), run_context ) - remote_file.cookbook_name = @new_resource.cookbook_name + remote_file.cookbook_name = new_resource.cookbook_name remote_file.source(cookbook_file) remote_file.backup(false) remote_file.run_action(:create) @@ -185,8 +185,8 @@ class Chef end def write_profile_to_disk - @new_resource.path(Chef::FileCache.create_cache_path("profiles")) - tempfile = Chef::FileContentManagement::Tempfile.new(@new_resource).tempfile + new_resource.path(Chef::FileCache.create_cache_path("profiles")) + tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile tempfile.write(@new_profile_hash.to_plist) tempfile.close tempfile.path @@ -240,13 +240,13 @@ class Chef def profile_installed? # Profile Identifier and UUID must match a currently installed profile - if @current_resource.profile.nil? || @current_resource.profile.empty? + if current_resource.profile.nil? || current_resource.profile.empty? false else - if @new_resource.action.include?(:remove) + if new_resource.action.include?(:remove) true else - @current_resource.profile["ProfileUUID"] == + current_resource.profile["ProfileUUID"] == @new_profile_hash["PayloadUUID"] end end |