Merge pull request #16690 from cachedout/issue_16658

Allow archive.extracted to be used during highstate run
This commit is contained in:
Thomas S Hatch 2014-10-16 16:32:47 -06:00
commit 98b22a2a9b

View File

@ -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
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))