Fix tar state options

Fixes #20795 as per discussion at
13f187fc5f
This commit is contained in:
Tiru Srikantha 2015-03-12 13:19:14 -07:00
parent 4d958f8677
commit 133318fb43

View File

@ -191,18 +191,23 @@ def extracted(name,
tar_cmd = ['tar']
tar_shortopts = 'x'
tar_longopts = []
tar_afterfile = []
for opt in tar_opts:
if not opt.startswith('-'):
for shortopt in opt:
if shortopt not in ['x', 'f']:
tar_shortopts = tar_shortopts + shortopt
else:
for position, opt in enumerate(tar_opts):
if opt.startswith('-'):
tar_longopts.append(opt)
else:
if position > 0:
tar_afterfile.append(opt)
else:
append_opt = opt
append_opt = append_opt.replace('x', '').replace('f', '')
tar_shortopts = tar_shortopts + append_opt
tar_cmd.append(tar_shortopts)
tar_cmd.extend(tar_longopts)
tar_cmd.extend(['-f', filename])
tar_cmd.extend(tar_afterfile)
results = __salt__['cmd.run_all'](tar_cmd, cwd=name, python_shell=False)
if results['retcode'] != 0: