From 90c278ad872887d7527f6963ef201d8337ec2595 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sat, 23 Jan 2021 12:15:33 +0100 Subject: [PATCH] lldp - use get_bin_path to locate the lldpctl executable (#1643) (#1663) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lldp - use get_bin_path to locate the lldpctl executable * This prevents failed executions FAILED! => {"changed": false, "cmd": "lldpctl -f keyvalue", "msg": "[Errno 2] No such file or directory", "rc": 2} on hosts (servers and switches) with lldpd installed and running. * Update changelogs/fragments/lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml Specify pull request id and minor formatting tweaks Co-authored-by: Felix Fontein * Update changelogs/fragments/lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml Co-authored-by: Felix Fontein Co-authored-by: Felix Fontein (cherry picked from commit 1dd5e71cff1573b9c6fd946f9cbacf25ff12331d) Co-authored-by: José Pedro Oliveira --- .../lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml | 2 ++ plugins/modules/net_tools/lldp.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml diff --git a/changelogs/fragments/lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml b/changelogs/fragments/lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml new file mode 100644 index 0000000000..4fefd3dd87 --- /dev/null +++ b/changelogs/fragments/lldp-use-get_bin_path-to-locate-the-lldpctl-executable.yaml @@ -0,0 +1,2 @@ +bugfixes: + - lldp - use ``get_bin_path`` to locate the ``lldpctl`` executable (https://github.com/ansible-collections/community.general/pull/1643). diff --git a/plugins/modules/net_tools/lldp.py b/plugins/modules/net_tools/lldp.py index 41853eb864..ae86db4088 100644 --- a/plugins/modules/net_tools/lldp.py +++ b/plugins/modules/net_tools/lldp.py @@ -41,7 +41,7 @@ from ansible.module_utils.basic import AnsibleModule def gather_lldp(module): - cmd = ['lldpctl', '-f', 'keyvalue'] + cmd = [module.get_bin_path('lldpctl'), '-f', 'keyvalue'] rc, output, err = module.run_command(cmd) if output: output_dict = {}