mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 19:31:26 -07: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:
parent
e979663dfe
commit
f9c60e1a82
1 changed files with 4 additions and 4 deletions
|
@ -24,16 +24,16 @@ from string import ascii_letters, digits
|
||||||
from ansible.module_utils._text import to_text
|
from ansible.module_utils._text import to_text
|
||||||
from ansible.config.manager import ConfigManager
|
from ansible.config.manager import ConfigManager
|
||||||
|
|
||||||
config = ConfigManager()
|
_config = ConfigManager()
|
||||||
|
|
||||||
# Generate constants from config
|
# Generate constants from config
|
||||||
for setting in config.data.get_settings():
|
for setting in _config.data.get_settings():
|
||||||
vars()[setting.name] = setting.value
|
vars()[setting.name] = setting.value
|
||||||
|
|
||||||
|
|
||||||
def mk_boolean(value):
|
def mk_boolean(value):
|
||||||
''' moved '''
|
''' moved '''
|
||||||
return config.make_boolean(value)
|
return _config.make_boolean(value)
|
||||||
|
|
||||||
|
|
||||||
# ### CONSTANTS ### yes, actual ones
|
# ### CONSTANTS ### yes, actual ones
|
||||||
|
@ -60,7 +60,7 @@ BECOME_MISSING_STRINGS = {
|
||||||
'ksu': 'No password given',
|
'ksu': 'No password given',
|
||||||
'pmrun': ''
|
'pmrun': ''
|
||||||
} # FIXME: deal with i18n
|
} # FIXME: deal with i18n
|
||||||
BOOL_TRUE = config.data.BOOL_TRUE
|
BOOL_TRUE = _config.data.BOOL_TRUE
|
||||||
DEFAULT_BECOME_PASS = None
|
DEFAULT_BECOME_PASS = None
|
||||||
DEFAULT_PASSWORD_CHARS = to_text(ascii_letters + digits + ".,:-_", errors='strict') # characters included in auto-generated passwords
|
DEFAULT_PASSWORD_CHARS = to_text(ascii_letters + digits + ".,:-_", errors='strict') # characters included in auto-generated passwords
|
||||||
DEFAULT_SUDO_PASS = None
|
DEFAULT_SUDO_PASS = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue