From 8a61303c888574ed42fd42f30c57086af009b997 Mon Sep 17 00:00:00 2001 From: Tom Berger Date: Thu, 30 Oct 2014 17:34:44 +0100 Subject: [PATCH] Move the cache file to ~/.ansible/tmp. A future branch might make it configurable. --- contrib/inventory/rax.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/inventory/rax.py b/contrib/inventory/rax.py index ff2cf63128..a42bbfcfef 100755 --- a/contrib/inventory/rax.py +++ b/contrib/inventory/rax.py @@ -167,7 +167,6 @@ except ImportError: print('pyrax is required for this module') sys.exit(1) -from tempfile import gettempdir from time import time @@ -345,7 +344,10 @@ def _list_into_cache(regions): def get_cache_file_path(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' % ( pyrax.identity.username, regions_str))