diff --git a/changelogs/fragments/10526-easy-install-cmd-list.yml b/changelogs/fragments/10526-easy-install-cmd-list.yml new file mode 100644 index 0000000000..6fa6717adc --- /dev/null +++ b/changelogs/fragments/10526-easy-install-cmd-list.yml @@ -0,0 +1,2 @@ +minor_changes: + - easy_install - using safer mechanism to run external command (https://github.com/ansible-collections/community.general/pull/10526). diff --git a/plugins/modules/easy_install.py b/plugins/modules/easy_install.py index 8d0a39333e..3eb56ecd11 100644 --- a/plugins/modules/easy_install.py +++ b/plugins/modules/easy_install.py @@ -89,7 +89,7 @@ from ansible.module_utils.basic import AnsibleModule def install_package(module, name, easy_install, executable_arguments): - cmd = '%s %s %s' % (easy_install, ' '.join(executable_arguments), name) + cmd = [easy_install] + executable_arguments + [name] rc, out, err = module.run_command(cmd) return rc, out, err