Closed traylenator closed 6 months ago
It is going to be a pain passing in the uid since you often do not know it.
Open to alternatives?
Having a fact that provides details on the running systemd --user
s seems bad with terrible race conditions.
@traylenator are you fine with this for now or should we wait for a solution to get the UID?
It is going to be a pain passing in the uid since you often do not know it.
Would a deferred function to resolve a username to uid be possible?
@traylenator are you fine with this for now or should we wait for a solution to get the UID?
I am fine with this as is. It unlocks quite a few things for Podman in particular and if we can support a user attribute all of this is still correct.
It is going to be a pain passing in the uid since you often do not know it.
Would a deferred function to resolve a username to uid be possible?
You can certainly do a deferred inline template for the exec command - less sure about the user parameter. Will have a play after this.
A getpwnam is a very generic function so would probably add it to extlib anyway.
I don't mind the array, but https://www.puppet.com/docs/puppet/7/types/exec.html#exec-attribute-command should really document that it was PUP-5704 that implemented it and you need at least Puppet 6.24.0 or Puppet 7.9.0.
Because of that we should raise the minimum version in
metadata.json
.
min puppet version bumped.
getpwnam is a very generic function so would probably add it to extlib anyway.
Wrong function:
of course.
@traylenator oh having those in extlib would be awesome! (and maybe be converted to the modern API :eyes: )
Almost feels generic enough to belong in stdlib.
Rebased - since we crossed the backwards incompatible threshold - would be good.
the code looks fine to me. But is it actually a backwards-incompatible change?
the code looks fine to me. But is it actually a backwards-incompatible change?
Only for exec.command = Array , so increase in puppet version.
I made the mistake at looking at this again:
machinectl shell mycentos@.host /usr/bin/systemctl --user daemon-reload
ran as root avoids the need to know the UID and assuming where things are.
Thanks for all the reviews - I've hopefully taken over all the comments to the new one.
Pull Request (PR) description
This change increased the minimum required Puppet version to 6.24.0 or 7.9.0 PUP-5704 to support arrays to the command attribute of the exec type.
Support calling the
systemd --user
for a particular uid.A
uid
must be used rather than the probably more convenient username since the$XDG_RUNTIME_DIR
for the user must be known.This change assumes that
XDG_RUNTIME_DIR
is/run/user/<uid>
for all uids.Example run:
results in
and a journal (debug on) of