Move the cache file to ~/.ansible/tmp.

A future branch might make it configurable.
This commit is contained in:
Tom Berger 2014-10-30 17:34:44 +01:00 committed by Abhijit Menon-Sen
parent 07a4076d12
commit 8a61303c88

View file

@ -167,7 +167,6 @@ except ImportError:
print('pyrax is required for this module') print('pyrax is required for this module')
sys.exit(1) sys.exit(1)
from tempfile import gettempdir
from time import time from time import time
@ -345,7 +344,10 @@ def _list_into_cache(regions):
def get_cache_file_path(regions): def get_cache_file_path(regions):
regions_str = '.'.join([reg.strip().lower() for reg in regions]) regions_str = '.'.join([reg.strip().lower() for reg in regions])
return os.path.join(gettempdir(), ansible_tmp_path = os.path.join(os.path.expanduser("~"), '.ansible', 'tmp')
if not os.path.exists(ansible_tmp_path):
os.makedirs(ansible_tmp_path)
return os.path.join(ansible_tmp_path,
'ansible-rax-%s-%s.cache' % ( 'ansible-rax-%s-%s.cache' % (
pyrax.identity.username, regions_str)) pyrax.identity.username, regions_str))