From 2612ceee3722d25810ceb805726b9c2e517a0985 Mon Sep 17 00:00:00 2001 From: Strahinja Kustudic Date: Mon, 17 Jun 2024 07:45:43 +0200 Subject: [PATCH] Fix launchd check-mode to report changed correctly (#8476) * Fix launchd check-mode to report changed correctly * Update changelog fragment. --------- Co-authored-by: Strahinja Kustudic Co-authored-by: Felix Fontein --- changelogs/fragments/8476-launchd-check-mode-changed.yaml | 2 ++ plugins/modules/launchd.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/8476-launchd-check-mode-changed.yaml diff --git a/changelogs/fragments/8476-launchd-check-mode-changed.yaml b/changelogs/fragments/8476-launchd-check-mode-changed.yaml new file mode 100644 index 0000000000..dc1e60de36 --- /dev/null +++ b/changelogs/fragments/8476-launchd-check-mode-changed.yaml @@ -0,0 +1,2 @@ +bugfixes: + - launched - correctly report changed status in check mode (https://github.com/ansible-collections/community.general/pull/8406). diff --git a/plugins/modules/launchd.py b/plugins/modules/launchd.py index e5942ea7cf..a6427bdb2f 100644 --- a/plugins/modules/launchd.py +++ b/plugins/modules/launchd.py @@ -514,7 +514,8 @@ def main(): result['status']['current_pid'] != result['status']['previous_pid']): result['changed'] = True if module.check_mode: - result['changed'] = True + if result['status']['current_state'] != action: + result['changed'] = True module.exit_json(**result)