summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Walck <nate.walck@gmail.com>2016-08-29 21:29:45 -0700
committerPhil Dibowitz <phil@ipom.com>2016-08-29 21:29:45 -0700
commitc16cf8be7c7f122a329171dfb13df51b8b60c0b2 (patch)
tree86931bde6afa9720beac83a0ba53fdcf2833187f
parent7fa458ad8fd0f428087449f79cc26b1d33cf50c6 (diff)
downloadchef-c16cf8be7c7f122a329171dfb13df51b8b60c0b2.tar.gz
Added fix for spaces in profile identifiers (#5159)
* Added fix for spaces in profile identifiers * Added an attempt to test spaces in identifier names * Derp, bad merge * Fixed osx profile spec test
-rw-r--r--lib/chef/provider/osx_profile.rb4
-rw-r--r--spec/unit/provider/osx_profile_spec.rb6
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb
index f5535f5c37..69ecf2ddb9 100644
--- a/lib/chef/provider/osx_profile.rb
+++ b/lib/chef/provider/osx_profile.rb
@@ -69,14 +69,14 @@ class Chef
a.assertion do
!@new_profile_identifier.nil? &&
!@new_profile_identifier.end_with?(".mobileconfig") &&
- /^\w+(?:\.\w+)+$/.match(@new_profile_identifier)
+ /^\w+(?:(\.| )\w+)+$/.match(@new_profile_identifier)
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
a.assertion do
!new_profile_name.end_with?(".mobileconfig") &&
- /^\w+(?:\.\w+)+$/.match(new_profile_name)
+ /^\w+(?:(\.| )\w+)+$/.match(new_profile_name)
end
a.failure_message RuntimeError, "When removing by resource name, it must match the profile identifier "
end
diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb
index e307bc2c22..a1dcf3ecd6 100644
--- a/spec/unit/provider/osx_profile_spec.rb
+++ b/spec/unit/provider/osx_profile_spec.rb
@@ -238,6 +238,12 @@ describe Chef::Provider::OsxProfile do
).to eql(new_resource.identifier)
end
+ it "should work with spaces in the identifier" do
+ provider.action = :remove
+ provider.define_resource_requirements
+ expect { provider.process_resource_requirements }.not_to raise_error
+ end
+
it "should build the shellout remove command correctly" do
new_resource.identifier "com.testprofile.screensaver"
new_resource.action(:remove)