mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #16690 from cachedout/issue_16658
Allow archive.extracted to be used during highstate run
This commit is contained in:
commit
98b22a2a9b
@ -109,6 +109,8 @@ def extracted(name,
|
||||
|
||||
log.debug('Input seem valid so far')
|
||||
filename = os.path.join(__opts__['cachedir'],
|
||||
'files',
|
||||
__env__,
|
||||
'{0}.{1}'.format(if_missing.replace('/', '_'),
|
||||
archive_format))
|
||||
if not os.path.exists(filename):
|
||||
@ -131,13 +133,27 @@ def extracted(name,
|
||||
]
|
||||
}
|
||||
}
|
||||
file_result = __salt__['state.high'](data)
|
||||
file_result = __salt__['state.single']('file.managed',
|
||||
filename,
|
||||
source=source,
|
||||
source_hash=source_hash,
|
||||
makedirs=True,
|
||||
saltenv=__env__)
|
||||
log.debug('file.managed: {0}'.format(file_result))
|
||||
# get value of first key
|
||||
file_result = file_result[file_result.keys()[0]]
|
||||
if not file_result['result']:
|
||||
log.debug('failed to download {0}'.format(source))
|
||||
return file_result
|
||||
try:
|
||||
file_result = file_result[file_result.keys()[0]]
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
try:
|
||||
if not file_result['result']:
|
||||
log.debug('failed to download {0}'.format(source))
|
||||
return file_result
|
||||
except TypeError:
|
||||
if not file_result:
|
||||
log.debug('failed to download {0}'.format(source))
|
||||
return file_result
|
||||
else:
|
||||
log.debug('Archive file {0} is already in cache'.format(name))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user