mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-16 04:47:30 +00:00
fix(launchd): restarted and reloaded always report changed in check mode too
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
7b764a84e2
commit
3b37d55146
1 changed files with 6 additions and 7 deletions
|
|
@ -501,23 +501,22 @@ def main():
|
|||
# Run the requested task
|
||||
if not module.check_mode:
|
||||
state, pid, status_code, err = tasks[action].run()
|
||||
# restarted and reloaded always perform commands unconditionally, so they always change state
|
||||
if action in ("restarted", "reloaded"):
|
||||
result["changed"] = True
|
||||
|
||||
result["status"]["current_state"] = ServiceState.to_string(state)
|
||||
result["status"]["current_pid"] = pid
|
||||
result["status"]["status_code"] = status_code
|
||||
result["status"]["error"] = err
|
||||
|
||||
if (
|
||||
# restarted and reloaded always perform commands unconditionally, so they always change state
|
||||
if action in ("restarted", "reloaded"):
|
||||
result["changed"] = True
|
||||
elif (
|
||||
result["status"]["current_state"] != result["status"]["previous_state"]
|
||||
or result["status"]["current_pid"] != result["status"]["previous_pid"]
|
||||
):
|
||||
result["changed"] = True
|
||||
if module.check_mode:
|
||||
if result["status"]["current_state"] != action:
|
||||
result["changed"] = True
|
||||
elif module.check_mode and result["status"]["current_state"] != action:
|
||||
result["changed"] = True
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue