* systemd module will now wait on deactivating state (#59471) If a service is in the 'deactivating' state running systemctl stop foo, would wait for the foo service to actually stop before it exits. The module didn't behave like that and it considered the deactivating state as if the service wasn't running. This change will align the module with the systemctl behaviour. (cherry picked from commit54d9d7805d
) * Fix systemd start state with deactivating service state (cherry picked from commitee4b3b8854
)
This commit is contained in:
parent
0af0a7f8bb
commit
aec6dc3b26
2 changed files with 7 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- systemd - wait for a service which is in deactivating state when using ``state=stopped`` (https://github.com/ansible/ansible/pull/59471)
|
|
@ -272,6 +272,10 @@ def is_running_service(service_status):
|
|||
return service_status['ActiveState'] in set(['active', 'activating'])
|
||||
|
||||
|
||||
def is_deactivating_service(service_status):
|
||||
return service_status['ActiveState'] in set(['deactivating'])
|
||||
|
||||
|
||||
def request_was_ignored(out):
|
||||
return '=' not in out and 'ignoring request' in out
|
||||
|
||||
|
@ -492,7 +496,7 @@ def main():
|
|||
if not is_running_service(result['status']):
|
||||
action = 'start'
|
||||
elif module.params['state'] == 'stopped':
|
||||
if is_running_service(result['status']):
|
||||
if is_running_service(result['status']) or is_deactivating_service(result['status']):
|
||||
action = 'stop'
|
||||
else:
|
||||
if not is_running_service(result['status']):
|
||||
|
|
Loading…
Reference in a new issue