-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
systemd::dropin_file doesn't cause a systemd daemon-reload #234
Comments
Whenever a dropin snippet is added or removed, systemd needs to be informed to assemble the full unit file. If for some odd reason, someone manages both a unit (systemd::unit_file) and add a dropin (systemd::dropin_file), `systemctl daemon-reload` will be called twice. This is useless but also harmless. Ideally, one would simply fold all settings into the base unit and forgo the dropin. Fixes voxpupuli#234 Signed-off-by: Simon Deziel <[email protected]>
Can you check what the output of Or is |
I am also affected by the problem at hand. Here's a quick reproducer with
Then running the agent:
Then with PR #237:
@ekohl, the key is the base unit_file is not managed by Puppet. |
Yep, same as what @simondeziel wrote. In my case I'm using our Vox Pupuli nginx module to manage nginx, but needed to add a dropin file as a workaround for voxpupuli/puppet-nginx/issues/1372, and noticed this problem with lack of daemon-reload. |
Right, that makes sense. I do wonder how to solve it. Perhaps it should be behind a boolean to either manage it or not? That way users who do manage the service don't get duplicate daemon reloads. I wouldn't want to depend on |
This crops up with a Where's the duplicate reload? If we call reload explicity in the puppet run then the one that puppet does automagicly in service restart won't happen. .. Or is there another one? |
That's a good point. I suppose the only duplicate reload would be if there are multiple drop in files. |
There's a good case for adding back the Whatever its better to do it > 1 rather than not at all. |
The single class was a recipe for disaster. I've run into problems because of it multiple times. In that case I'd prefer a |
Some systems probably have hundreds or thousands of systemd units managed through puppet so the |
This also crops up if content for .service via a Somehow the internal logic of puppet when to execute a daemon-reload is not stable nor trustworthy and we end up adding manual reloads all over the place :-( |
I guess this issue got fixed with: #199 |
I have this problem as well when I use dropin _file for puppet-run.serice, which is installed by class profile::puppet::agent::common {
$systemd_unit_content = @("SYSTEMD_UNIT")
# Managed by Puppet
#
[Unit]
Description=Systemd Service for reporting status of Puppet Agent run
After=network.target
[Service]
Type=oneshot
ExecStart=/usr/bin/logger -t puppet-agent -p local0.err "puppet agent run failed"
User=root
Group=root
[Install]
WantedBy=puppet-run.service
| SYSTEMD_UNIT
systemd::unit_file { 'puppet-report.service':
content => $systemd_unit_content,
enable => true,
}
$onfailure_content = @("ONFAILURE_CONTENT")
# Managed by Puppet
#
[Unit]
OnFailure=puppet-report.service
| ONFAILURE_CONTENT
systemd::dropin_file { 'onfailure.conf':
unit => 'puppet-run.service',
content => $onfailure_content,
require => Systemd::Unit_file['puppet-report.service'],
notify_service => true,
}
} and
I run puppet in debug and verbose mode and I didn't see |
Just stumbled across this issue as well. I guess we need to re-implement |
We implemented this by means of a
Is there a reason this couldn't be part of the systemd module itself? It collects all changes to dropin files and runs |
It used to have that, but it was very common to run into dependency cycles. Suppose you need one service fully running before you configure another, which is quite common. |
@ekohl If you need to have a service running before configuring another, then your systemd configuration files should reflect that using triggers. I'm now also running into this issue with |
My main point is that I think a single |
* Add a `systemd::daemon_reload` defined type * Ensure that any file additions to the /etc/systemd/system space are followed by a call to `systemd::daemon_reload` * Allow users to disable the calls to `systemd::daemon_reload` * Allow users to globally disable the `systemctl daemon-reload` exec using a resource collector if necessary * Hook the daemon reload between the file creation and the service as is usually necessary, where possible Fixes #234 Fixes #199
Running some tests now and will PR soon. |
* Add a `systemd::daemon_reload` defined type * Ensure that any file additions to the /etc/systemd/system space are followed by a call to `systemd::daemon_reload` * Allow users to disable the calls to `systemd::daemon_reload` * Allow users to globally disable the `systemctl daemon-reload` exec using a resource collector if necessary * Hook the daemon reload between the file creation and the service as is usually necessary, where possible * Add a 'best effort' optional exec as `systemd::lazy_daemon_reload` to try and clean up systems that were modified betweedn 2.9.0 and this release Fixes #234 Fixes #199
CentOS 8 has been archived
* Add a `systemd::daemon_reload` defined type * Ensure that any file additions to the /etc/systemd/system space are followed by a call to `systemd::daemon_reload` * Allow users to disable the calls to `systemd::daemon_reload` * Allow users to globally disable the `systemctl daemon-reload` exec using a resource collector if necessary * Hook the daemon reload between the file creation and the service as is usually necessary, where possible * Add a 'best effort' optional exec as `systemd::lazy_daemon_reload` to try and clean up systems that were modified betweedn 2.9.0 and this release Fixes #234 Fixes #199 Co-authored-by: Ewoud Kohl van Wijngaarden <[email protected]>
Affected Puppet, Ruby, OS and module versions/distributions
How to reproduce (e.g Puppet code you use)
What are you seeing
systemd not reloaded.
What behaviour did you expect instead
systemctl daemon-reload
should be done.The text was updated successfully, but these errors were encountered: