mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
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:
commit
9cce5449c5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user