Only print warning when ansible.cfg is actually skipped (#43583)

Only print warning when ansible.cfg is actually skipped

* Also add unittests for the find_ini_config_file function
* Add documentation on world writable current working directory
  config files can no longer be loaded from a world writable current
  working directory but the end user is allowed to specify that
  explicitly.  Give appropriate warnings and information on how.

Fixes #42388
This commit is contained in:
Toshio Kuratomi 2018-08-03 10:39:33 -07:00 committed by GitHub
parent 48280463f2
commit 30662bedad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 314 additions and 26 deletions

View file

@ -3,6 +3,7 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import os.path
from ansible.compat.tests import unittest
@ -50,12 +51,6 @@ class TestConfigData(unittest.TestCase):
self.assertIsInstance(ensure_type('0.10', 'float'), float)
self.assertIsInstance(ensure_type(0.2, 'float'), float)
def test_find_ini_file(self):
cur_config = os.environ['ANSIBLE_CONFIG']
os.environ['ANSIBLE_CONFIG'] = cfg_file
self.assertEquals(cfg_file, find_ini_config_file())
os.environ['ANSIBLE_CONFIG'] = cur_config
def test_resolve_path(self):
self.assertEquals(os.path.join(curdir, 'test.yml'), resolve_path('./test.yml', cfg_file))