Fixes for run_command shell usage in remainder of packaging modules, save portinstall.

This commit is contained in:
Michael DeHaan
2014-03-12 16:57:18 -04:00
parent 6010e74839
commit 81b4ebbe1d
5 changed files with 13 additions and 10 deletions

View File

@@ -58,13 +58,14 @@ pkgutil: name=CSWcommon state=present
# Install a package from a specific repository
pkgutil: name=CSWnrpe site='ftp://myinternal.repo/opencsw/kiel state=latest'
'''
import os
import pipes
def package_installed(module, name):
cmd = [module.get_bin_path('pkginfo', True)]
cmd.append('-q')
cmd.append(name)
#rc, out, err = module.run_command(' '.join(cmd), shell=False)
rc, out, err = module.run_command(' '.join(cmd))
if rc == 0:
return True
@@ -73,12 +74,14 @@ 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 += [ '| tail -1 | grep -v SAME' ]
rc, out, err = module.run_command(' '.join(cmd))
rc, out, err = module.run_command(' '.join(cmd), use_unsafe_shell=True)
if rc == 1:
return True
else: