1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-07-08 19:49:09 +00:00

fix(launchd): restarted and reloaded always report changed

Both actions unconditionally execute commands (unload/load/start),
so changed must always be True in non-check mode, regardless of
whether the PID or state happened to match before and after.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alexei Znamensky 2026-05-30 21:40:13 +12:00
parent 38399c8107
commit cd6b128253

View file

@ -501,6 +501,9 @@ 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