Merge pull request #19361 from jfindlay/ensure_cmds

make some command contexts explicit
This commit is contained in:
Mike Place 2015-01-05 15:49:13 -07:00
commit eb6fd3d538
2 changed files with 6 additions and 6 deletions

View File

@ -343,7 +343,7 @@ def _sunos_cpudata():
grains['cpuarch'] = __salt__['cmd.run']('uname -p')
psrinfo = '/usr/sbin/psrinfo 2>/dev/null'
grains['num_cpus'] = len(__salt__['cmd.run'](psrinfo).splitlines())
grains['num_cpus'] = len(__salt__['cmd.run'](psrinfo, python_shell=True).splitlines())
kstat_info = 'kstat -p cpu_info:0:*:brand'
for line in __salt__['cmd.run'](kstat_info).splitlines():
match = re.match(r'(\w+:\d+:\w+\d+:\w+)\s+(.+)', line)
@ -389,7 +389,7 @@ def _memdata(osdata):
grains['mem_total'] = int(mem) / 1024 / 1024
elif osdata['kernel'] == 'SunOS':
prtconf = '/usr/sbin/prtconf 2>/dev/null'
for line in __salt__['cmd.run'](prtconf).splitlines():
for line in __salt__['cmd.run'](prtconf, python_shell=True).splitlines():
comps = line.split(' ')
if comps[0].strip() == 'Memory' and comps[1].strip() == 'size:':
grains['mem_total'] = int(comps[2].strip())
@ -1589,7 +1589,7 @@ def _smartos_zone_data():
grains['pkgsrcpath'] = 'Unknown'
grains['zonename'] = __salt__['cmd.run']('zonename')
grains['zoneid'] = __salt__['cmd.run']('zoneadm list -p | awk -F: \'{ print $1 }\'')
grains['zoneid'] = __salt__['cmd.run']('zoneadm list -p | awk -F: \'{ print $1 }\'', python_shell=True)
grains['hypervisor_uuid'] = __salt__['cmd.run']('mdata-get sdc:server_uuid')
grains['datacenter'] = __salt__['cmd.run']('mdata-get sdc:datacenter_name')
if "FAILURE" in grains['datacenter'] or "No metadata" in grains['datacenter']:

View File

@ -186,13 +186,13 @@ def extracted(name,
else:
log.debug('Untar {0} in {1}'.format(filename, name))
results = __salt__['cmd.run_all']('tar x{0} -f {1!r}'.format(
tar_options, filename), cwd=name)
tar_cmd = ['tar', 'x{0}'.format(tar_options), '-f', repr(filename)]
results = __salt__['cmd.run_all'](tar_cmd, cwd=name, python_shell=False)
if results['retcode'] != 0:
ret['result'] = False
ret['changes'] = results
return ret
if __salt__['cmd.retcode']('tar --version | grep bsdtar') == 0:
if __salt__['cmd.retcode']('tar --version | grep bsdtar', python_shell=True) == 0:
files = results['stderr']
else:
files = results['stdout']