summaryrefslogtreecommitdiff
path: root/lib/chef/provider/service/macosx.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@getchef.com>2014-04-16 12:14:23 -0700
committerdanielsdeleo <dan@getchef.com>2014-04-16 12:14:23 -0700
commit8f4efbdd3540987192486f4913b1928c9619d5f3 (patch)
tree975e68127a0ea668a1f33369f6b9e8a8f3d34e00 /lib/chef/provider/service/macosx.rb
parentdad83ca8eca2c8679ac381a0bbf2a08d5ebe2fbf (diff)
downloadchef-8f4efbdd3540987192486f4913b1928c9619d5f3.tar.gz
Make OS X service resource work when the plist doesn't exist yet.
Diffstat (limited to 'lib/chef/provider/service/macosx.rb')
-rw-r--r--lib/chef/provider/service/macosx.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb
index ca78c2eaee..8a8eb62263 100644
--- a/lib/chef/provider/service/macosx.rb
+++ b/lib/chef/provider/service/macosx.rb
@@ -59,7 +59,7 @@ class Chef
a.failure_message Chef::Exceptions::Service, "Several plist files match service name. Please use full service name."
end
- requirements.assert(:all_actions) do |a|
+ requirements.assert(:enable, :disable) do |a|
a.assertion { !@service_label.to_s.empty? }
a.failure_message Chef::Exceptions::Service,
"Could not find service's label in plist file '#{@plist}'!"
@@ -172,6 +172,10 @@ class Chef
private
def find_service_label
+ # CHEF-5223 "you can't glob for a file that hasn't been converged
+ # onto the node yet."
+ return nil if @plist.nil?
+
# Most services have the same internal label as the name of the
# plist file. However, there is no rule saying that *has* to be
# the case, and some core services (notably, ssh) do not follow