mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
store cloudforms inventory cache files in the proper location on disk
with process isolation enabled (which is the awx default), cloudforms caches inventory script results on disk; awx should direct cloudforms to store these cache files in a location that's exposed to the isolated environment see: ansible/ansible#31760
This commit is contained in:
parent
3d12e040ed
commit
5895654538
@ -1794,6 +1794,11 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
section = 'cache'
|
section = 'cache'
|
||||||
cp.add_section(section)
|
cp.add_section(section)
|
||||||
cp.set(section, 'max_age', "0")
|
cp.set(section, 'max_age', "0")
|
||||||
|
cache_path = tempfile.mkdtemp(
|
||||||
|
prefix='cloudforms_cache',
|
||||||
|
dir=kwargs.get('private_data_dir', None)
|
||||||
|
)
|
||||||
|
cp.set(section, 'path', cache_path)
|
||||||
|
|
||||||
elif inventory_update.source == 'azure_rm':
|
elif inventory_update.source == 'azure_rm':
|
||||||
section = 'azure'
|
section = 'azure'
|
||||||
|
@ -1473,6 +1473,10 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
assert config.get('cloudforms', 'username') == 'bob'
|
assert config.get('cloudforms', 'username') == 'bob'
|
||||||
assert config.get('cloudforms', 'password') == 'secret'
|
assert config.get('cloudforms', 'password') == 'secret'
|
||||||
assert config.get('cloudforms', 'ssl_verify') == 'false'
|
assert config.get('cloudforms', 'ssl_verify') == 'false'
|
||||||
|
|
||||||
|
cache_path = config.get('cache', 'path')
|
||||||
|
assert cache_path.startswith(env['AWX_PRIVATE_DATA_DIR'])
|
||||||
|
assert os.path.isdir(cache_path)
|
||||||
return ['successful', 0]
|
return ['successful', 0]
|
||||||
|
|
||||||
self.run_pexpect.side_effect = run_pexpect_side_effect
|
self.run_pexpect.side_effect = run_pexpect_side_effect
|
||||||
|
Loading…
Reference in New Issue
Block a user