1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix in pkgutil: don't call pipes.quote() on None.

In this function, 'site' may be None, which will cause an exception
if it is passed to pipes.quote().
This commit is contained in:
Todd Owen 2014-06-12 12:59:09 +08:00
parent 3fb3e7e6dc
commit 247f70cf5c

View file

@ -74,12 +74,10 @@ def package_installed(module, name):
def package_latest(module, name, site):
# Only supports one package
name = pipes.quote(name)
site = pipes.quote(site)
cmd = [ 'pkgutil', '--single', '-c' ]
if site is not None:
cmd += [ '-t', site ]
cmd.append(name)
cmd += [ '-t', pipes.quote(site) ]
cmd.append(pipes.quote(name))
cmd += [ '| tail -1 | grep -v SAME' ]
rc, out, err = module.run_command(' '.join(cmd), use_unsafe_shell=True)
if rc == 1: