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

module/systemd: fix logic determining if a service needs to be enable… #46318

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- In systemd module, allow scope to default to 'system'
- In systemd module, fix check if a systemd+initd service is enabled - disabled in systemd means disabled
5 changes: 3 additions & 2 deletions lib/ansible/modules/system/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,11 @@ def main():
enabled = True
elif rc == 1:
# if not a user or global user service and both init script and unit file exist stdout should have enabled/disabled, otherwise use rc entries
if module.params['scope'] == 'system' and \
if module.params['scope'] in (None, 'system') and \
not module.params['user'] and \
is_initd and \
(not out.strip().endswith('disabled') or sysv_is_enabled(unit)):
not out.strip().endswith('disabled') and \
sysv_is_enabled(unit):
enabled = True

# default to current state
Expand Down