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

Do a daemon reload for static units #199

Merged
merged 2 commits into from
Oct 20, 2021

Conversation

simondeziel
Copy link
Contributor

Services that are deployed by systemd::timer need to trigger a systemctl daemon-reload when the .service file is changed.

systemd::timer { 'foo.timer':
    timer_content   => $foo_timer,
    service_content => $foo_service,
    active          => true,
    enable          => true,
}

results in a foo.service that is neither active nor enabled. It is a "static" unit that will be triggered by the foo.timer alone. This fixes #190 and more specifically: #190 (comment)

Services that are deployed by systemd::timer need to trigger a
`systemctl daemon-reload` when the .service file is changed.

  systemd::timer { 'foo.timer':
    timer_content   => $foo_timer,
    service_content => $foo_service,
    active          => true,
    enable          => true,
  }

results in a foo.service that is neither active nor enabled. It is
a "static" unit that will be triggered by the foo.timer alone. This
fixes voxpupuli#190 and more specifically:

voxpupuli#190 (comment)

Signed-off-by: Simon Deziel <[email protected]>
@kenyon
Copy link
Member

kenyon commented Jun 16, 2021

Can you also update the tests in https://github.com/voxpupuli/puppet-systemd/blob/master/spec/defines/unit_file_spec.rb to cover this? That way we don't have a regression.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is good, but as @kenyon said: tests would be nice.

@ekohl
Copy link
Member

ekohl commented Oct 19, 2021

@simondeziel do you think you could add a test for this?

simondeziel added a commit to simondeziel/puppet-systemd that referenced this pull request Oct 19, 2021
Signed-off-by: Simon Deziel <[email protected]>
simondeziel added a commit to simondeziel/puppet-systemd that referenced this pull request Oct 19, 2021
Signed-off-by: Simon Deziel <[email protected]>
@simondeziel
Copy link
Contributor Author

@kenyon or @ekohl I don't know ruby/spec so please let me know what I got wrong in those tests ;)

@bastelfreak bastelfreak added bug Something isn't working and removed needs-tests labels Oct 19, 2021
@bastelfreak bastelfreak merged commit 8a4c566 into voxpupuli:master Oct 20, 2021
@simondeziel simondeziel deleted the static-unit branch October 20, 2021 12:54
trevor-vaughan added a commit that referenced this pull request Jun 10, 2022
* 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
trevor-vaughan added a commit that referenced this pull request Jun 10, 2022
* 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
trevor-vaughan added a commit that referenced this pull request Jun 17, 2022
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

daemon reload problem with 3.0.0
4 participants