mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
states.archive: use archive.cmd_unzip when possible
cmd_unzip is preferable as python's zip module does not preserve permissions or mtimes. See https://bugs.python.org/issue15795.
This commit is contained in:
parent
928a7891b4
commit
d64ae48783
1 changed files with 10 additions and 1 deletions
|
@ -374,7 +374,16 @@ def extracted(name,
|
|||
|
||||
log.debug('Extracting {0} to {1}'.format(filename, name))
|
||||
if archive_format == 'zip':
|
||||
files = __salt__['archive.unzip'](filename, name, trim_output=trim_output, password=password)
|
||||
if password is None and salt.utils.which('unzip'):
|
||||
files = __salt__['archive.cmd_unzip'](filename, name, trim_output=trim_output)
|
||||
else:
|
||||
# https://bugs.python.org/issue15795
|
||||
if password is not None:
|
||||
log.warning('Password supplied: using archive.unzip')
|
||||
if not salt.utils.which('unzip'):
|
||||
log.warning('Cannot find unzip command for archive.cmd_unzip:'
|
||||
' using archive.unzip instead')
|
||||
files = __salt__['archive.unzip'](filename, name, trim_output=trim_output, password=password)
|
||||
elif archive_format == 'rar':
|
||||
files = __salt__['archive.unrar'](filename, name, trim_output=trim_output)
|
||||
else:
|
||||
|
|
Loading…
Add table
Reference in a new issue