From 78cd8886f4e6a3a72e615a4ffaa50da9ef660ee6 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 1 Dec 2021 13:19:28 +0100 Subject: [PATCH] ip_netns - invoke run_command passing list (#3822) (#3828) * ip_netns - invoke run_command passing list * added changelog fragment (cherry picked from commit ba9578f12a03517a80e52b09b20778ff4b4764d2) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/3822-ip_netns-run-list.yaml | 2 ++ plugins/modules/net_tools/ip_netns.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/3822-ip_netns-run-list.yaml diff --git a/changelogs/fragments/3822-ip_netns-run-list.yaml b/changelogs/fragments/3822-ip_netns-run-list.yaml new file mode 100644 index 0000000000..7bbcb59277 --- /dev/null +++ b/changelogs/fragments/3822-ip_netns-run-list.yaml @@ -0,0 +1,2 @@ +minor_changes: + - ip_netns - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3822). diff --git a/plugins/modules/net_tools/ip_netns.py b/plugins/modules/net_tools/ip_netns.py index 700f0a17bd..00f1112bc0 100644 --- a/plugins/modules/net_tools/ip_netns.py +++ b/plugins/modules/net_tools/ip_netns.py @@ -76,7 +76,7 @@ class Namespace(object): def exists(self): '''Check if the namespace already exists''' - rc, out, err = self.module.run_command('ip netns list') + rc, out, err = self.module.run_command(['ip', 'netns', 'list']) if rc != 0: self.module.fail_json(msg=to_text(err)) return self.name in out