summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-09-04 10:26:27 -0700
committerTim Smith <tsmith84@gmail.com>2020-09-04 10:26:27 -0700
commit92aa38336073df5f289a9caabf52981aad0718ca (patch)
tree18043e3f48e2aee43d926fe13634daa594ae6b73
parent928abf3e72ef9759551d80a23a4fc79730d2aa60 (diff)
downloadchef-92aa38336073df5f289a9caabf52981aad0718ca.tar.gz
Allow removing profiles in osx_profile on Big Sur
Users may want to cleanup old profiles after upgrading a Catalina box to Big Sur. We should allow for that. It's just installing new profiles where we need to fail hard. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/resource/osx_profile.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index 23a4e86505..c3ff099436 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -80,10 +80,6 @@ class Chef
end
def check_resource_semantics!
- if mac? && node["platform_version"] =~ ">= 11.0"
- raise "The osx_profile resource is not available on macOS Big Sur or above due to Apple's removal of support for CLI profile installation"
- end
-
if action == :remove
if new_profile_identifier
if invalid_profile_name?(new_profile_identifier)
@@ -97,6 +93,11 @@ class Chef
end
if action == :install
+ # we only do this check for the install action so that profiles can still be removed on macOS 11+
+ if mac? && node["platform_version"] =~ ">= 11.0"
+ raise "The osx_profile resource is not available on macOS Big Sur or above due to Apple's removal of support for CLI profile installation"
+ end
+
if new_profile_hash.is_a?(Hash) && !new_profile_hash.include?("PayloadIdentifier")
raise "The specified profile does not seem to be valid"
end