Antoine Pietri 2 weeks ago committed by GitHub
commit 7d4704ed0a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,4 @@
bugfixes:
- module_utils - When checking that it is possible to cd in current working
directory before running a module, ansible now also checks that the directory
is searchable (+x).

@ -1331,7 +1331,7 @@ class AnsibleModule(object):
def _set_cwd(self):
try:
cwd = os.getcwd()
if not os.access(cwd, os.F_OK | os.R_OK):
if not os.access(cwd, os.F_OK | os.R_OK | os.X_OK):
raise Exception()
return cwd
except Exception:
@ -1339,7 +1339,7 @@ class AnsibleModule(object):
# Try and move to a neutral location to prevent errors
for cwd in [self.tmpdir, os.path.expandvars('$HOME'), tempfile.gettempdir()]:
try:
if os.access(cwd, os.F_OK | os.R_OK):
if os.access(cwd, os.F_OK | os.R_OK | os.X_OK):
os.chdir(cwd)
return cwd
except Exception:

Loading…
Cancel
Save