summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorNate Walck <nate.walck@gmail.com>2016-02-01 21:17:30 -0800
committerNate Walck <nate.walck@gmail.com>2016-02-02 14:12:59 -0800
commit4d3c45b37c66d20b3799551e99a8dcd9fa3228c4 (patch)
tree710c7dc119f5382c791ecd8e3488499c7fd16a2c /lib
parent5536dd9e73159e3eff1b42be79f46d6f0540c4a1 (diff)
downloadchef-4d3c45b37c66d20b3799551e99a8dcd9fa3228c4.tar.gz
Bad test lead to a provider coverage failure for brand new machines with no profiles installed
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/provider/osx_profile.rb11
1 files changed, 7 insertions, 4 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