diff options
-rw-r--r-- | lib/chef/provider/osx_profile.rb | 4 | ||||
-rw-r--r-- | spec/unit/provider/osx_profile_spec.rb | 6 |
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) |