Merge pull request #2661 from mscherer/remove_unsafe_shell_apt_repos

Split a shell snippet in 2 to avoid using use_unsafe_shell=True
This commit is contained in:
Brian Coca 2016-01-25 23:45:02 -05:00
commit 9e5737d776

View file

@ -116,7 +116,10 @@ def install_python_apt(module):
if not module.check_mode:
apt_get_path = module.get_bin_path('apt-get')
if apt_get_path:
rc, so, se = module.run_command('%s update && %s install python-apt -y -q' % (apt_get_path, apt_get_path), use_unsafe_shell=True)
rc, so, se = module.run_command([apt_get_path, 'update'])
if rc != 0:
module.fail_json(msg="Failed to auto-install python-apt. Error was: '%s'" % se.strip())
rc, so, se = module.run_command([apt_get_path, 'install', 'python-apt', '-y', '-q'])
if rc == 0:
global apt, apt_pkg, aptsources_distro, distro, HAVE_PYTHON_APT
import apt