diff options
author | Phil Dibowitz <phil@ipom.com> | 2016-02-02 14:38:52 -0800 |
---|---|---|
committer | Phil Dibowitz <phil@ipom.com> | 2016-02-02 14:38:52 -0800 |
commit | 85518e379aeb1c69089de588de28fd20a7cc7546 (patch) | |
tree | 245193f7a92ee059adf21ed677fd5f5487fe592b | |
parent | a27aada46427ed7fe366bb9e9f57ca6f94272f97 (diff) | |
parent | 4d3c45b37c66d20b3799551e99a8dcd9fa3228c4 (diff) | |
download | chef-85518e379aeb1c69089de588de28fd20a7cc7546.tar.gz |
Merge pull request #4511 from natewalck/osx-profiles-fix
Fix osx_profile coverage failure and update spec
-rw-r--r-- | lib/chef/provider/osx_profile.rb | 11 | ||||
-rw-r--r-- | spec/unit/provider/osx_profile_spec.rb | 2 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb index 071b4b0462..dccda49e1d 100644 --- a/lib/chef/provider/osx_profile.rb +++ b/lib/chef/provider/osx_profile.rb @@ -54,10 +54,13 @@ class Chef @new_resource.profile_name end - current_profile = all_profiles["_computerlevel"].find { - |item| item["ProfileIdentifier"] == - @new_profile_identifier - } + if all_profiles.empty? + current_profile = nil + else + current_profile = all_profiles["_computerlevel"].find do |item| + item["ProfileIdentifier"] == @new_profile_identifier + end + end @current_resource.profile(current_profile) end diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb index 76bfc3b4eb..f1e16d08db 100644 --- a/spec/unit/provider/osx_profile_spec.rb +++ b/spec/unit/provider/osx_profile_spec.rb @@ -106,7 +106,7 @@ describe Chef::Provider::OsxProfile do } end let(:no_profiles) do - { "_computerlevel"=> [] } + { } end before(:each) do |