From 3fa1c3ac2caee4fbe79905fd1fec6df7eefc7f43 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 10 Aug 2025 13:50:43 +0200 Subject: [PATCH] [PR #10599/1bd7aac0 backport][stable-11] open_iscsi: command args as list rather than string (#10633) open_iscsi: command args as list rather than string (#10599) * open_iscsi: command args as list rather than string * add changelog frag (cherry picked from commit 1bd7aac07e48053d3e75bb3e18ff3aa01f18911c) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> --- changelogs/fragments/10599-open-iscsi-cmd-list.yml | 2 ++ plugins/modules/open_iscsi.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/10599-open-iscsi-cmd-list.yml diff --git a/changelogs/fragments/10599-open-iscsi-cmd-list.yml b/changelogs/fragments/10599-open-iscsi-cmd-list.yml new file mode 100644 index 0000000000..f8ef659ee9 --- /dev/null +++ b/changelogs/fragments/10599-open-iscsi-cmd-list.yml @@ -0,0 +1,2 @@ +minor_changes: + - open_iscsi - using safer mechanism to run external command (https://github.com/ansible-collections/community.general/pull/10599). diff --git a/plugins/modules/open_iscsi.py b/plugins/modules/open_iscsi.py index 80360833a2..82f56a8cff 100644 --- a/plugins/modules/open_iscsi.py +++ b/plugins/modules/open_iscsi.py @@ -242,7 +242,7 @@ def target_login(module, target, check_rc, portal=None, port=None): params = [('node.session.auth.username_in', node_user_in), ('node.session.auth.password_in', node_pass_in)] for (name, value) in params: - cmd = '%s --mode node --targetname %s --op=update --name %s --value %s' % (iscsiadm_cmd, target, name, value) + cmd = [iscsiadm_cmd, '--mode', 'node', '--targetname', target, '--op=update', '--name', name, '--value', value] module.run_command(cmd, check_rc=check_rc) cmd = [iscsiadm_cmd, '--mode', 'node', '--targetname', target, '--login']