Skip to content
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 instances of systemd --user #443

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

traylenator
Copy link
Contributor

@traylenator traylenator commented Mar 29, 2024

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 the calling the systemd --user daemon-reload for a particular user.

Example run:

notify{'junk':
 notify => Systemd::Daemon_reload['user_foobar'],
}

systemd::daemon_reload{'user_steve':
  user => 'steve',
}

This results on a Fedora box:

Notice: /Stage[main]/Main/Notify[junk]/message: defined 'message' as 'junk'
Notice: /Stage[main]/Main/Systemd::Daemon_reload[user_steve]/Package[systemd-container]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Main/Systemd::Daemon_reload[user_steve]/Exec[systemd-user_steve-systemctl-user-steve-daemon-reload]: Triggered 'refresh' from 1 event

and a journal (debug on) for [email protected] of

Mar 29 10:32:11 fedora systemd[2062]: Created slice background.slice - User Background Tasks Slice.
Mar 29 10:32:11 fedora systemd[2062]: Starting systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files and Directories...
Mar 29 10:32:11 fedora systemd[2062]: Reloading requested from client PID 4379 ('systemctl')...
Mar 29 10:32:11 fedora systemd[2062]: Reloading...
Mar 29 10:32:11 fedora systemd[2062]: Reloading finished in 179 ms.
Mar 29 10:32:11 fedora systemd[2062]: Finished systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files and Directories.

Only recent versions of systemd-run support the --machine option or actually manage to connect to DBUS.

@bastelfreak
Copy link
Member

@traylenator I think the bump to Puppet >= 7.9 is missing? (And I'm still torn if that's a breaking change or not).

@traylenator
Copy link
Contributor Author

systemd-run --pipe --wait --user --machine [email protected] systemctl --user daemon-reload

is a better command since the return code makes it out.

This change increased the minimum required Puppet version to 6.24.0 or 7.9.0 [PUP-5704](https://puppet.atlassian.net/browse/PUP-5704) to support arrays to the command attribute of the exec type.

Support the calling the `systemd --user daemon-reload` for a particular user.

Example run:
```puppet
  notify{'junk':
    notify => Systemd::Daemon_reload['user_foobar'],
  }

  systemd::daemon_reload{'user_steve':
    user => 'steve',
  }
```

This results on a Fedora box:

```
Notice: /Stage[main]/Main/Notify[junk]/message: defined 'message' as 'junk'
Notice: /Stage[main]/Main/Systemd::Daemon_reload[user_steve]/Package[systemd-container]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Main/Systemd::Daemon_reload[user_steve]/Exec[systemd-user_steve-systemctl-user-steve-daemon-reload]: Triggered 'refresh' from 1 event
```
and a journal (debug on) for [email protected] of

```
Mar 29 10:32:11 fedora systemd[2062]: Created slice background.slice - User Background Tasks Slice.
Mar 29 10:32:11 fedora systemd[2062]: Starting systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files and Directories...
Mar 29 10:32:11 fedora systemd[2062]: Reloading requested from client PID 4379 ('systemctl')...
Mar 29 10:32:11 fedora systemd[2062]: Reloading...
Mar 29 10:32:11 fedora systemd[2062]: Reloading finished in 179 ms.
Mar 29 10:32:11 fedora systemd[2062]: Finished systemd-tmpfiles-clean.service - Cleanup of User's Temporary Files and Directories.
...

Only recent versions of `systemd-run` support the --machine option or actually manage to connect to DBUS.
@traylenator traylenator merged commit f1c49bf into voxpupuli:master Apr 8, 2024
35 checks passed
@traylenator traylenator deleted the machinectl branch April 8, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants