mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
fixed reported state
This commit is contained in:
@@ -325,6 +325,10 @@ def main():
|
|||||||
result['enabled'] = enabled
|
result['enabled'] = enabled
|
||||||
|
|
||||||
if module.params['state'] is not None:
|
if module.params['state'] is not None:
|
||||||
|
|
||||||
|
# default to desired state
|
||||||
|
result['state'] = module.params['state']
|
||||||
|
|
||||||
# What is current service state?
|
# What is current service state?
|
||||||
if 'ActiveState' in result['status']:
|
if 'ActiveState' in result['status']:
|
||||||
action = None
|
action = None
|
||||||
@@ -338,6 +342,7 @@ def main():
|
|||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
else:
|
else:
|
||||||
action = module.params['state'][:-2] # remove 'ed' from restarted/reloaded
|
action = module.params['state'][:-2] # remove 'ed' from restarted/reloaded
|
||||||
|
result['state'] = 'started'
|
||||||
result['changed'] = True
|
result['changed'] = True
|
||||||
|
|
||||||
if action:
|
if action:
|
||||||
@@ -349,7 +354,6 @@ def main():
|
|||||||
# this should not happen?
|
# this should not happen?
|
||||||
module.fail_json(msg="Service is in unknown state", status=result['status'])
|
module.fail_json(msg="Service is in unknown state", status=result['status'])
|
||||||
|
|
||||||
result['state'] = module.params['state']
|
|
||||||
|
|
||||||
module.exit_json(**result)
|
module.exit_json(**result)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user