-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 and Windows resources when not resource found will now return error #9175
Merged
joshcooper
merged 2 commits into
puppetlabs:main
from
cthorn42:bug_fix/main/error_when_resource_not_found
Dec 20, 2023
Merged
SystemD and Windows resources when not resource found will now return error #9175
joshcooper
merged 2 commits into
puppetlabs:main
from
cthorn42:bug_fix/main/error_when_resource_not_found
Dec 20, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When managing the `ensure` state for a service, the provider queries the service status to determine if it's running or not. However, if the service doesn't exist, then it returns that the service is `stopped`. When trying to ensure a non-existent service is stopped, puppet thinks the service is "insync", so returns exit code 0. This commit updates the systemd provider's enable method to return either :running, :stopped or :absent. To differentiate between `stopped` vs `absent`, the provider first checks if the service exists. This adds `absent` as a valid value for the `ensure` property, however, it can't be set on a provider, since we don't want to remove services: puppet resource service ufw ensure=absent Error: The systemd provider can not handle attribute ensure
cthorn42
force-pushed
the
bug_fix/main/error_when_resource_not_found
branch
4 times, most recently
from
December 15, 2023 19:21
935be7a
to
dfc2bad
Compare
joshcooper
reviewed
Dec 15, 2023
joshcooper
reviewed
Dec 15, 2023
joshcooper
reviewed
Dec 15, 2023
joshcooper
reviewed
Dec 15, 2023
joshcooper
reviewed
Dec 15, 2023
Could you remove the |
cthorn42
force-pushed
the
bug_fix/main/error_when_resource_not_found
branch
3 times, most recently
from
December 18, 2023 20:56
5104059
to
129115f
Compare
cthorn42
changed the title
Bug fix/main/error when resource not found
SystemD and Windows resources when not resource found will now return error
Dec 18, 2023
joshcooper
reviewed
Dec 19, 2023
cthorn42
force-pushed
the
bug_fix/main/error_when_resource_not_found
branch
2 times, most recently
from
December 19, 2023 23:53
d92c0b5
to
1dd8fe2
Compare
…sent Previously if a service was not present on a system and a user tried to manage that service with `puppet resource service`, and that service wasn't there an error message would appear on the screen but the puppet command would return a 0 exit code. This commit is meant to bubble up those error messages so they will be reflected on the command line properly. First pass will be to update the Windows and Systemd providers. blank
cthorn42
force-pushed
the
bug_fix/main/error_when_resource_not_found
branch
from
December 20, 2023 17:23
1dd8fe2
to
4f6a2ea
Compare
joshcooper
approved these changes
Dec 20, 2023
Backport failed for Please cherry-pick the changes locally. git fetch origin 7.x
git worktree add -d .worktree/backport-9175-to-7.x origin/7.x
cd .worktree/backport-9175-to-7.x
git checkout -b backport-9175-to-7.x
ancref=$(git merge-base 9ceca21e565f0771b9bffe88a20894506c015602 4f6a2ea27ffa4451a327002bca045194d937f7aa)
git cherry-pick -x $ancref..4f6a2ea27ffa4451a327002bca045194d937f7aa |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport 7.x
Generate a backport PR to 7.x
maintenance
Maintenance chores are excluded from changelogs
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously when Windows or SystemD attempted to managed a non-existant resource Puppet would just return that the service was stopped. This could be a bit confusing since if the service doesn't exist, that should be made explicit and we should do more then just returning that the service is in a 'stopped' state.
This change will cause Puppet to return an error message if a Windows/Systemd service is not found while trying to manage said service.