Gate atd service on package ensure. - #99
Conversation
PROBLEM:
The at class always declared service { 'atd': ensure => 'running' }, even when package_ensure was absent or purged. That made Puppet try to manage a running service while the at package was being removed or absent, which is inconsistent and can fail once the service unit is gone.
SOLUTION:
Introduce $manage_service = !($package_ensure in ['absent', 'purged']) and wrap the atd service resource in if $manage_service { ... } so the service is not declared when the package is not expected to be present. Document package_ensure accordingly, update REFERENCE.md, and add RSpec contexts for absent, purged, and latest.
TESTING METHODOLOGY:
CI.
OUTCOME:
Removing or purging the at package no longer triggers management of atd; installs using installed, present, latest, or a version string still get the service managed as before.
|
Your change seems reasonable. Did you intend for it to still be in draft state? |
|
Thanks for catching this @janbrono — the bug is real: with We reviewed the PR and think the fix needs a few changes before it can merge. Documenting them here: 1. Declare the service stopped/disabled instead of omitting it. Gating service { 'atd':
ensure => 'stopped',
enable => false,
before => Package['at'], # stop before removal; converges even if the erase fails
}2. Gate the config files too. With the package absent/purged, the class still manages 3. Housekeeping the RELENG CI enforces. The branch predates current master (metadata.json 1.0.0 vs the 2.0.1 tag), so it needs a rebase, a version bump past 2.0.1, and a matching CHANGELOG entry — 4. Smaller items: One thing we verified while reviewing, in case it comes up: |
PROBLEM:
The at class always declared service { 'atd': ensure => 'running' }, even when package_ensure was absent or purged. That made Puppet try to manage a running service while the at package was being removed or absent, which is inconsistent and can fail once the service unit is gone.
SOLUTION:
Introduce $manage_service = !($package_ensure in ['absent', 'purged']) and wrap the atd service resource in if $manage_service { ... } so the service is not declared when the package is not expected to be present. Document package_ensure accordingly, update REFERENCE.md, and add RSpec contexts for absent, purged, and latest.
TESTING METHODOLOGY:
CI.
OUTCOME:
Removing or purging the at package no longer triggers management of atd; installs using installed, present, latest, or a version string still get the service managed as before.