Use xz -t instead of xz -l to test if archive is packed with xz

lzma v4, which comes with CentOS 6, does not support -l
This commit is contained in:
mephi42 2017-02-18 22:49:23 +01:00
parent 3fc1e2c9f8
commit 53d81f3804
2 changed files with 2 additions and 2 deletions

View File

@ -186,7 +186,7 @@ def list_(name,
raise CommandExecutionError('Invalid CLI options') raise CommandExecutionError('Invalid CLI options')
else: else:
if salt.utils.which('xz') \ if salt.utils.which('xz') \
and __salt__['cmd.retcode'](['xz', '-l', cached], and __salt__['cmd.retcode'](['xz', '-t', cached],
python_shell=False, python_shell=False,
ignore_retcode=True) == 0: ignore_retcode=True) == 0:
decompress_cmd = 'xz --decompress --stdout' decompress_cmd = 'xz --decompress --stdout'

View File

@ -1193,7 +1193,7 @@ def extracted(name,
except tarfile.ReadError: except tarfile.ReadError:
if salt.utils.which('xz'): if salt.utils.which('xz'):
if __salt__['cmd.retcode']( if __salt__['cmd.retcode'](
['xz', '-l', cached_source], ['xz', '-t', cached_source],
python_shell=False, python_shell=False,
ignore_retcode=True) == 0: ignore_retcode=True) == 0:
# XZ-compressed data # XZ-compressed data