From b6d6468c92e4dcd41ea1636c1022bf36ee5c5bbc Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 22 Jul 2018 16:09:04 -0400 Subject: [PATCH] issue #301: support expandvars() for remote_tmp only. Vanilla Ansible support expandvars-like expansions widely in a variety of places. Prefer to whitelist those we need, rather than sprinkling hellish semantics everywhere. --- ansible_mitogen/target.py | 3 +++ tests/ansible/ansible.cfg | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ansible_mitogen/target.py b/ansible_mitogen/target.py index c9be4bfb..22c5cb02 100644 --- a/ansible_mitogen/target.py +++ b/ansible_mitogen/target.py @@ -407,6 +407,9 @@ def make_temp_directory(base_dir): :returns: Newly created temporary directory. """ + # issue #301: remote_tmp may contain $vars. + base_dir = os.path.expandvars(base_dir) + if not os.path.exists(base_dir): os.makedirs(base_dir, mode=int('0700', 8)) return tempfile.mkdtemp( diff --git a/tests/ansible/ansible.cfg b/tests/ansible/ansible.cfg index e00cc974..7bf849d5 100644 --- a/tests/ansible/ansible.cfg +++ b/tests/ansible/ansible.cfg @@ -17,8 +17,9 @@ timeout = 10 # On Travis, paramiko check fails due to host key checking enabled. host_key_checking = False -# Required by integration/runner__remote_tmp.yml -remote_tmp = ~/.ansible/mitogen-tests/ +# "mitogen-tests" required by integration/runner/remote_tmp.yml +# "$HOME" required by integration/action/make_tmp_path.yml +remote_tmp = $HOME/.ansible/mitogen-tests/ [ssh_connection] ssh_args = -o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=60s