diff options
author | Tim Smith <tsmith@chef.io> | 2017-09-06 12:51:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 12:51:07 -0700 |
commit | 294742ef45336b97cafc1742c6adfd1d6657c710 (patch) | |
tree | 9a9e3bf7a1dd98101868d1b418b3f7479faea681 /lib/chef/provider/service | |
parent | 38f8845fda94c6640ab905ef84f182db38c5f51f (diff) | |
parent | 518b27b7b22468d0ebde0b9370e113d31c8ccf2a (diff) | |
download | chef-294742ef45336b97cafc1742c6adfd1d6657c710.tar.gz |
Merge pull request #6353 from mikedodge04/launchd2
Launchd should not load launchagents as root.
Diffstat (limited to 'lib/chef/provider/service')
-rw-r--r-- | lib/chef/provider/service/macosx.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb index 4056b72649..9dc7b81a29 100644 --- a/lib/chef/provider/service/macosx.rb +++ b/lib/chef/provider/service/macosx.rb @@ -52,17 +52,18 @@ class Chef @plist_size = 0 @plist = @new_resource.plist ? @new_resource.plist : find_service_plist @service_label = find_service_label - # LauchAgents should be loaded as the console user. + # LaunchAgents should be loaded as the console user. @console_user = @plist ? @plist.include?("LaunchAgents") : false @session_type = @new_resource.session_type if @console_user - @console_user = Etc.getlogin + @console_user = Etc.getpwuid(::File.stat("/dev/console").uid).name Chef::Log.debug("#{new_resource} console_user: '#{@console_user}'") cmd = "su " param = this_version_or_newer?("10.10") ? "" : "-l " + param = "-l " if this_version_or_newer?("10.12") @base_user_cmd = cmd + param + "#{@console_user} -c" - # Default LauchAgent session should be Aqua + # Default LaunchAgent session should be Aqua @session_type = "Aqua" if @session_type.nil? end |