diff options
author | Mike Dodge <mikedodge04@fb.com> | 2015-03-26 15:09:19 -0700 |
---|---|---|
committer | Mike Dodge <mikedodge04@fb.com> | 2015-03-26 15:09:19 -0700 |
commit | 0d1bc71edebcf4b7e11b5640c9331bc13030bf91 (patch) | |
tree | c1bf53dae6701bc73165dc8cf60bd8452b7b9d13 /lib | |
parent | 5b8fcf1e8285643e797090de505f33d5aab2a89f (diff) | |
download | chef-0d1bc71edebcf4b7e11b5640c9331bc13030bf91.tar.gz |
added requsted chagnes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/provider/service/macosx.rb | 13 | ||||
-rw-r--r-- | lib/chef/resource/macosx_service.rb | 1 |
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb index 82c66c3199..38ea6124bf 100644 --- a/lib/chef/provider/service/macosx.rb +++ b/lib/chef/provider/service/macosx.rb @@ -96,6 +96,11 @@ class Chef @current_resource.running(false) end end + + requirements.assert(:all_actions) do |a| + a.assertion { @plist.nil? ? true : ::File.exists?(@plist) } + a.failure_message Chef::Exceptions::Service, "#{@plist} does not exist" + end end def start_service @@ -156,15 +161,15 @@ class Chef def load_service session = @session_type ? "-S #{@session_type} " : '' cmd = 'launchctl load -w ' + session + @plist - shell_out_with_su?(cmd) + shell_out_as_user(cmd) end def unload_service cmd = 'launchctl unload -w ' + @plist - shell_out_with_su?(cmd) + shell_out_as_user(cmd) end - def shell_out_with_su?(cmd) + def shell_out_as_user(cmd) if @console_user shell_out_with_systems_locale("#{@base_user_cmd} '#{cmd}'") else @@ -177,7 +182,7 @@ class Chef return if @plist == nil or @service_label.to_s.empty? cmd = "launchctl list #{@service_label}" - res = shell_out_with_su?(cmd) + res = shell_out_as_user(cmd) if res.exitstatus == 0 @current_resource.enabled(true) diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb index be58dc6676..879ea99cf8 100644 --- a/lib/chef/resource/macosx_service.rb +++ b/lib/chef/resource/macosx_service.rb @@ -39,7 +39,6 @@ class Chef # This will enable user to pass a plist in the case # that the filename and label for the service dont match def plist(arg=nil) - assert_path_exists(arg) unless arg.nil? set_or_return( :plist, arg, |