summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAjay Chand <achand@fb.com>2016-05-10 15:01:26 -0700
committerAjay Chand <achand@fb.com>2016-05-10 15:01:26 -0700
commitf8db5e7169ebd207f4174717d3eef0f305483115 (patch)
tree4d89f6c2dab1f887624dd9a2da36224ee03369d3
parent6fe31094c894780116d8438c040e04632d9d01c0 (diff)
downloadchef-f8db5e7169ebd207f4174717d3eef0f305483115.tar.gz
fix profile provider for nil
-rw-r--r--lib/chef/provider/osx_profile.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb
index 6ac67e0560..6c55a42817 100644
--- a/lib/chef/provider/osx_profile.rb
+++ b/lib/chef/provider/osx_profile.rb
@@ -54,11 +54,10 @@ class Chef
@new_resource.profile_name
end
- if all_profiles.empty?
- current_profile = nil
- else
- current_profile = all_profiles["_computerlevel"].find do |item|
- item["ProfileIdentifier"] == @new_profile_identifier
+ current_profile = nil
+ if all_profiles && !all_profiles.empty?
+ current_profile = all_profiles['_computerlevel'].find do |item|
+ item['ProfileIdentifier'] == @new_profile_identifier
end
end
@current_resource.profile(current_profile)