Use user's home dir for fact cache

Rather than putting fact cache in /tmp, we should store it in the user's
directory to prevent issues with facts being leaked to /tmp.
Additionally this prevents issues if you are running a mix of commands
with sudo and without.  Fact cache is now located in
~/.tripleo/fact_cache rather thank /tmp/tripleo-ansible/fact_cache.

Change-Id: I5ce626810ab235b2aabb0c8a333e03a5c9a2bfb9
Closes-Bug: #1901550
(cherry picked from commit fddf15109a)
This commit is contained in:
Alex Schultz 2020-10-29 14:54:57 -06:00
parent aa44664dc3
commit 85893d6b26
1 changed files with 2 additions and 4 deletions

View File

@ -439,10 +439,8 @@ def run_ansible_playbook(playbook, inventory, workdir, playbook_dir=None,
)
cwd = os.getcwd()
ansible_fact_path = os.path.join(
os.path.join(
tempfile.gettempdir(),
'tripleo-ansible'
),
os.path.expanduser('~'),
'.tripleo',
'fact_cache'
)
makedirs(ansible_fact_path)