summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2018-05-21 09:13:44 +0100
committerGitHub <noreply@github.com>2018-05-21 09:13:44 +0100
commit9877e3a4ee7e7a0b267d932ab08a8773e2b8329f (patch)
tree58cb109a9767685ab07378dbca8bc8816f6085c5 /lib/chef/provider
parent60846aebe0220bf69972e6a6846eac68924de924 (diff)
parent3071b022ccb88a0c3298ebf613c0109f97ff4b55 (diff)
downloadchef-9877e3a4ee7e7a0b267d932ab08a8773e2b8329f.tar.gz
Merge pull request #7274 from mal/fix-systemd-user-calls
Fix systemd_unit user context
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/service/systemd.rb2
-rw-r--r--lib/chef/provider/systemd_unit.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index 1bcc2f3a00..704f94a7ff 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -77,7 +77,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
def get_systemctl_options_args
if new_resource.user
- uid = Etc.getpwuid(new_resource.user).uid
+ uid = Etc.getpwnam(new_resource.user).uid
options = {
:environment => {
"DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/#{uid}/bus",
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index d8c83d2b4b..0c02b4491c 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -219,7 +219,7 @@ class Chef
end
def daemon_reload
- shell_out_with_systems_locale!("#{systemctl_path} daemon-reload")
+ shell_out_with_systems_locale!("#{systemctl_cmd} daemon-reload", systemctl_opts)
end
def systemctl_execute!(action, unit)
@@ -245,7 +245,7 @@ class Chef
def systemctl_opts
@systemctl_opts ||=
if new_resource.user
- uid = Etc.getpwuid(new_resource.user).uid
+ uid = Etc.getpwnam(new_resource.user).uid
{
:user => new_resource.user,
:environment => {