From 754cd3119599e99925028f275681228bfa24392c Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 10 Jul 2021 13:49:24 +0200 Subject: [PATCH] launchd - fixed validation check (#2960) (#2975) * replaced use of expanduser() with value from HOME var * fixed sanity check * added changelog fragment (cherry picked from commit 1990f79d8a69ae6fef7457d853c54d9348aad2fa) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/2960-launchd-validation-check.yaml | 2 ++ plugins/modules/system/launchd.py | 2 +- tests/sanity/ignore-2.10.txt | 1 - tests/sanity/ignore-2.11.txt | 1 - tests/sanity/ignore-2.12.txt | 1 - tests/sanity/ignore-2.9.txt | 1 - 6 files changed, 3 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/2960-launchd-validation-check.yaml diff --git a/changelogs/fragments/2960-launchd-validation-check.yaml b/changelogs/fragments/2960-launchd-validation-check.yaml new file mode 100644 index 0000000000..15cb3c3fa5 --- /dev/null +++ b/changelogs/fragments/2960-launchd-validation-check.yaml @@ -0,0 +1,2 @@ +bugfixes: + - launchd - fixed sanity check in the module's code (https://github.com/ansible-collections/community.general/pull/2960). diff --git a/plugins/modules/system/launchd.py b/plugins/modules/system/launchd.py index 919d8d7bd2..b7a5efdfff 100644 --- a/plugins/modules/system/launchd.py +++ b/plugins/modules/system/launchd.py @@ -159,7 +159,7 @@ class Plist: """Finds the plist file associated with a service""" launchd_paths = [ - os.path.expanduser('~/Library/LaunchAgents'), + os.path.join(os.getenv('HOME'), 'Library/LaunchAgents'), '/Library/LaunchAgents', '/Library/LaunchDaemons', '/System/Library/LaunchAgents', diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt index c82c4d82c9..024b084559 100644 --- a/tests/sanity/ignore-2.10.txt +++ b/tests/sanity/ignore-2.10.txt @@ -143,7 +143,6 @@ plugins/modules/storage/purestorage/purefb_facts.py validate-modules:parameter-l plugins/modules/storage/purestorage/purefb_facts.py validate-modules:return-syntax-error plugins/modules/system/gconftool2.py validate-modules:parameter-state-invalid-choice plugins/modules/system/iptables_state.py validate-modules:undocumented-parameter -plugins/modules/system/launchd.py use-argspec-type-path # False positive plugins/modules/system/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/system/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/system/puppet.py use-argspec-type-path diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index 20637fd842..320f8ccb2e 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -142,7 +142,6 @@ plugins/modules/storage/purestorage/purefb_facts.py validate-modules:parameter-l plugins/modules/storage/purestorage/purefb_facts.py validate-modules:return-syntax-error plugins/modules/system/gconftool2.py validate-modules:parameter-state-invalid-choice plugins/modules/system/iptables_state.py validate-modules:undocumented-parameter -plugins/modules/system/launchd.py use-argspec-type-path # False positive plugins/modules/system/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/system/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/system/puppet.py use-argspec-type-path diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt index 41804fcfca..9d4eb9918c 100644 --- a/tests/sanity/ignore-2.12.txt +++ b/tests/sanity/ignore-2.12.txt @@ -142,7 +142,6 @@ plugins/modules/storage/purestorage/purefb_facts.py validate-modules:parameter-l plugins/modules/storage/purestorage/purefb_facts.py validate-modules:return-syntax-error plugins/modules/system/gconftool2.py validate-modules:parameter-state-invalid-choice plugins/modules/system/iptables_state.py validate-modules:undocumented-parameter -plugins/modules/system/launchd.py use-argspec-type-path # False positive plugins/modules/system/osx_defaults.py validate-modules:parameter-state-invalid-choice plugins/modules/system/parted.py validate-modules:parameter-state-invalid-choice plugins/modules/system/puppet.py use-argspec-type-path diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index 1269b84799..aee9fee172 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -180,7 +180,6 @@ plugins/modules/storage/purestorage/purefb_facts.py validate-modules:deprecation plugins/modules/storage/purestorage/purefb_facts.py validate-modules:invalid-documentation plugins/modules/storage/purestorage/purefb_facts.py validate-modules:return-syntax-error plugins/modules/system/iptables_state.py validate-modules:undocumented-parameter -plugins/modules/system/launchd.py use-argspec-type-path # False positive plugins/modules/system/puppet.py use-argspec-type-path plugins/modules/system/puppet.py validate-modules:parameter-type-not-in-doc plugins/modules/system/runit.py validate-modules:parameter-type-not-in-doc