-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support reload of systemd --user
for non-zero UIDs
#416
Conversation
systemd --user
for non-zero UIDssystemd --user
for non-zero UIDs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style nits, otherwise 🚀
8ce0530
to
e7d5d35
Compare
2834d9a
to
4e3d0a1
Compare
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 |
@traylenator are you fine with this for now or should we wait for a solution to get the UID? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
Would a deferred function to resolve a username to uid be possible? |
890d64d
to
bb61394
Compare
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. |
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. |
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 👀 ) |
Almost feels generic enough to belong in stdlib. |
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: ```puppet notify{'junk': notify => Systemd::Daemon_reload['foobar'], } systemd::daemon_reload{'foobar': uid => 1000, } ``` results in ``` Notice: Compiled catalog for fedora. in environment production in 0.05 seconds Notice: junk Notice: /Stage[main]/Main/Notify[junk]/message: defined 'message' as 'junk' Notice: /Stage[main]/Main/Systemd::Daemon_reload[foobar]/Exec[systemd-foobar-systemctl-user-1000-daemon-reload]: Triggered 'refresh' from 1 event Notice: Applied catalog in 0.17 seconds ``` and a journal (debug on) of ``` Feb 28 11:44:34 fedora systemd[1]: [email protected]: Got notification message from PID 1877 (RELOADING=1, MONOTONIC_USEC=5874581103) Feb 28 11:44:34 fedora systemd[1]: [email protected]: Changed running -> reload-notify Feb 28 11:44:34 fedora systemd[1]: [email protected]: Installed new job [email protected]/nop as 6151 ...
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? |
Only for exec.command = Array , so increase in puppet version. |
I made the mistake at looking at this again:
ran as root avoids the need to know the UID and assuming where things are. |
#443 is a much better solution and avoids all the user -> uid hassles. |
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