Merge pull request #19930 from highlyunavailable/feature/fix_tar_options

Split out tar options into long and short array-based arguments
This commit is contained in:
Thomas S Hatch 2015-01-22 12:23:06 -07:00
commit 9cce5449c5

View File

@ -186,7 +186,23 @@ def extracted(name,
else:
log.debug('Untar {0} in {1}'.format(filename, name))
tar_cmd = ['tar', 'x{0}'.format(tar_options), '-f', repr(filename)]
tar_opts = tar_options.split(' ')
tar_cmd = ['tar']
tar_shortopts = 'x'
tar_longopts = []
for opt in tar_opts:
if not opt.startswith('-'):
if opt not in ['x', 'f']:
tar_shortopts = tar_shortopts + opt
else:
tar_longopts.append(opt)
tar_cmd.append(tar_shortopts)
tar_cmd.extend(tar_longopts)
tar_cmd.extend(['-f', filename])
results = __salt__['cmd.run_all'](tar_cmd, cwd=name, python_shell=False)
if results['retcode'] != 0:
ret['result'] = False