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