diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2016-08-04 16:35:36 -0700 |
---|---|---|
committer | Brian Coca <bcoca@users.noreply.github.com> | 2016-08-04 19:35:36 -0400 |
commit | 1ecf51d87e90e877cce387c738f1496eba2da93c (patch) | |
tree | 3c56d6c4933aaccc9d4a800e761f26862464f3e3 /lib/ansible/constants.py | |
parent | 746ea64d305a95862c1fbc2835de2c5e1724283d (diff) | |
download | ansible-1ecf51d87e90e877cce387c738f1496eba2da93c.tar.gz |
* Fix race in creating temp directories pre-fork (#16965)
* These can still race when multiple ansible processes are created at
the same time.
* Reverse order of expanduser and expandvars in unfrakpath(). So that
tildes in environment variables will be handled.
Diffstat (limited to 'lib/ansible/constants.py')
-rw-r--r-- | lib/ansible/constants.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index e24ed82341..f29728e639 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -28,6 +28,7 @@ from ansible.compat.six.moves import configparser from ansible.parsing.quoting import unquote from ansible.errors import AnsibleOptionsError +from ansible.utils.path import makedirs_safe BOOL_TRUE = frozenset([ "true", "t", "y", "1", "yes", "on" ]) @@ -77,7 +78,7 @@ def get_config(p, section, key, env_var, default, boolean=False, integer=False, elif istmppath: value = shell_expand(value) if not os.path.exists(value): - os.makedirs(value, 0o700) + makedirs_safe(value, 0o700) prefix = 'ansible-local-%s' % os.getpid() value = tempfile.mkdtemp(prefix=prefix, dir=value) elif ispathlist: |