mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Fix another corner case of too many warnings for world readable current working directory
There should be no warning if there is no ansible.cfg file i nthe current working directory.
This commit is contained in:
parent
8ed7e80fc8
commit
f46c943d3d
3 changed files with 38 additions and 2 deletions
|
@ -176,10 +176,14 @@ def find_ini_config_file(warnings=None):
|
|||
try:
|
||||
cwd = os.getcwd()
|
||||
perms = os.stat(cwd)
|
||||
cwd_cfg = os.path.join(cwd, "ansible.cfg")
|
||||
if perms.st_mode & stat.S_IWOTH:
|
||||
warn_cmd_public = True
|
||||
# Working directory is world writable so we'll skip it.
|
||||
# Still have to look for a file here, though, so that we know if we have to warn
|
||||
if os.path.exists(cwd_cfg):
|
||||
warn_cmd_public = True
|
||||
else:
|
||||
potential_paths.append(os.path.join(cwd, "ansible.cfg"))
|
||||
potential_paths.append(cwd_cfg)
|
||||
except OSError:
|
||||
# If we can't access cwd, we'll simply skip it as a possible config source
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue