1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Make the ConfigManager in constants private

All play focused code should access constants via ansible.constants, not
via the config API.  Even that API should only be used by
ansible-config.  It should be considered an internal implementation
detail to everything else
This commit is contained in:
Toshio Kuratomi 2017-07-14 10:31:24 -07:00
parent e979663dfe
commit f9c60e1a82

View file

@ -24,16 +24,16 @@ from string import ascii_letters, digits
from ansible.module_utils._text import to_text
from ansible.config.manager import ConfigManager
config = ConfigManager()
_config = ConfigManager()
# Generate constants from config
for setting in config.data.get_settings():
for setting in _config.data.get_settings():
vars()[setting.name] = setting.value
def mk_boolean(value):
''' moved '''
return config.make_boolean(value)
return _config.make_boolean(value)
# ### CONSTANTS ### yes, actual ones
@ -60,7 +60,7 @@ BECOME_MISSING_STRINGS = {
'ksu': 'No password given',
'pmrun': ''
} # FIXME: deal with i18n
BOOL_TRUE = config.data.BOOL_TRUE
BOOL_TRUE = _config.data.BOOL_TRUE
DEFAULT_BECOME_PASS = None
DEFAULT_PASSWORD_CHARS = to_text(ascii_letters + digits + ".,:-_", errors='strict') # characters included in auto-generated passwords
DEFAULT_SUDO_PASS = None