mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
Merge pull request #661 from matburt/651_fix_rax_cache_behavior
Fix for rax cache timeout issue
This commit is contained in:
commit
296ca52b0f
@ -1194,6 +1194,7 @@ class RunInventoryUpdate(BaseTask):
|
||||
elif inventory_update.source == 'rax':
|
||||
env['RAX_CREDS_FILE'] = cloud_credential
|
||||
env['RAX_REGION'] = inventory_update.source_regions or 'all'
|
||||
env['RAX_CACHE_MAX_AGE'] = "0"
|
||||
# Set this environment variable so the vendored package won't
|
||||
# complain about not being able to determine its version number.
|
||||
env['PBR_VERSION'] = '0.5.21'
|
||||
|
@ -355,9 +355,12 @@ def get_cache_file_path(regions):
|
||||
|
||||
|
||||
def _list(regions, refresh_cache=True):
|
||||
cache_max_age = int(get_config(p, 'rax', 'cache_max_age',
|
||||
'RAX_CACHE_MAX_AGE', 600))
|
||||
|
||||
if (not os.path.exists(get_cache_file_path(regions)) or
|
||||
refresh_cache or
|
||||
(time() - os.stat(get_cache_file_path(regions))[-1]) > 600):
|
||||
(time() - os.stat(get_cache_file_path(regions))[-1]) > cache_max_age):
|
||||
# Cache file doesn't exist or older than 10m or refresh cache requested
|
||||
_list_into_cache(regions)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user