From 183ba93ba39f8590af8e36144c3174920acbe321 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 15 May 2019 16:36:30 -0400 Subject: [PATCH] removed previouslly deprecated settings (#55662) * removed previouslly deprecated settings fixes #55304 * also removed from play context --- .../fragments/removed_obsolete_configs.yml | 2 + lib/ansible/config/base.yml | 84 ------------------- lib/ansible/constants.py | 15 ---- lib/ansible/playbook/play_context.py | 11 --- lib/ansible/plugins/shell/__init__.py | 6 -- 5 files changed, 2 insertions(+), 116 deletions(-) create mode 100644 changelogs/fragments/removed_obsolete_configs.yml diff --git a/changelogs/fragments/removed_obsolete_configs.yml b/changelogs/fragments/removed_obsolete_configs.yml new file mode 100644 index 0000000000..0f55ec9fb5 --- /dev/null +++ b/changelogs/fragments/removed_obsolete_configs.yml @@ -0,0 +1,2 @@ +minor_changes: + - All previouslly deprecated sudo/su and module locale global settings have been removed. diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 76db1844b8..f91c72746f 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -418,32 +418,6 @@ DEFAULT_ASK_PASS: - {key: ask_pass, section: defaults} type: boolean yaml: {key: defaults.ask_pass} -DEFAULT_ASK_SUDO_PASS: - name: Ask for the sudo password - default: False - deprecated: - why: In favor of Ansible Become, which is a generic framework. See become_ask_pass. - version: "2.9" - alternatives: become - description: - - This controls whether an Ansible playbook should prompt for a sudo password. - env: [{name: ANSIBLE_ASK_SUDO_PASS}] - ini: - - {key: ask_sudo_pass, section: defaults} - type: boolean -DEFAULT_ASK_SU_PASS: - name: Ask for the su password - default: False - deprecated: - why: In favor of Ansible Become, which is a generic framework. See become_ask_pass. - version: "2.9" - alternatives: become - description: - - This controls whether an Ansible playbook should prompt for a su password. - env: [{name: ANSIBLE_ASK_SU_PASS}] - ini: - - {key: ask_su_pass, section: defaults} - type: boolean DEFAULT_ASK_VAULT_PASS: name: Ask for the vault password(s) default: False @@ -851,19 +825,6 @@ DEFAULT_MODULE_COMPRESSION: - {key: module_compression, section: defaults} # vars: # - name: ansible_module_compression -DEFAULT_MODULE_LANG: - name: Target language environment - default: "{{ CONTROLLER_LANG }}" - description: - - "Language locale setting to use for modules when they execute on the target." - - "If empty it tries to set itself to the LANG environment variable on the controller." - - "This is only used if DEFAULT_MODULE_SET_LOCALE is set to true" - env: [{name: ANSIBLE_MODULE_LANG}] - ini: - - {key: module_lang, section: defaults} - deprecated: - why: Modules are coded to set their own locale if needed for screenscraping - version: "2.9" DEFAULT_MODULE_NAME: name: Default adhoc module default: command @@ -879,18 +840,6 @@ DEFAULT_MODULE_PATH: ini: - {key: library, section: defaults} type: pathspec -DEFAULT_MODULE_SET_LOCALE: - name: Target locale - default: False - description: - - Controls if we set locale for modules when executing on the target. - env: [{name: ANSIBLE_MODULE_SET_LOCALE}] - ini: - - {key: module_set_locale, section: defaults} - type: boolean - deprecated: - why: Modules are coded to set their own locale if needed for screenscraping - version: "2.9" DEFAULT_MODULE_UTILS_PATH: name: Module Utils Path description: Colon separated paths in which Ansible will search for Module utils files, which are shared by modules. @@ -1108,39 +1057,6 @@ DEFAULT_SU: - {key: su, section: defaults} type: boolean yaml: {key: defaults.su} -DEFAULT_SU_EXE: - name: su executable - default: su - deprecated: - why: In favor of Ansible Become, which is a generic framework. See become_exe. - version: "2.9" - alternatives: become - description: 'specify an "su" executable, otherwise it relies on PATH.' - env: [{name: ANSIBLE_SU_EXE}] - ini: - - {key: su_exe, section: defaults} -DEFAULT_SU_FLAGS: - name: su flags - default: '' - deprecated: - why: In favor of Ansible Become, which is a generic framework. See become_flags. - version: "2.9" - alternatives: become - description: 'Flags to pass to su' - env: [{name: ANSIBLE_SU_FLAGS}] - ini: - - {key: su_flags, section: defaults} -DEFAULT_SU_USER: - name: su user - default: - description: 'User you become when using "su", leaving it blank will use the default configured on the target (normally root)' - env: [{name: ANSIBLE_SU_USER}] - ini: - - {key: su_user, section: defaults} - deprecated: - why: In favor of Ansible Become, which is a generic framework. See become_user. - version: "2.9" - alternatives: become DEFAULT_SYSLOG_FACILITY: name: syslog facility default: LOG_USER diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 309edbba97..051d7258cf 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -97,13 +97,10 @@ BECOME_METHODS = _DeprecatedSequenceConstant( # CONSTANTS ### yes, actual ones BLACKLIST_EXTS = ('.pyc', '.pyo', '.swp', '.bak', '~', '.rpm', '.md', '.txt', '.rst') BOOL_TRUE = BOOLEANS_TRUE -CONTROLLER_LANG = os.getenv('LANG', 'en_US.UTF-8') DEFAULT_BECOME_PASS = None DEFAULT_PASSWORD_CHARS = to_text(ascii_letters + digits + ".,:-_", errors='strict') # characters included in auto-generated passwords -DEFAULT_SUDO_PASS = None DEFAULT_REMOTE_PASS = None DEFAULT_SUBSET = None -DEFAULT_SU_PASS = None # FIXME: expand to other plugins, but never doc fragments CONFIGURABLE_PLUGINS = ('become', 'cache', 'callback', 'cliconf', 'connection', 'httpapi', 'inventory', 'lookup', 'shell') # NOTE: always update the docs/docsite/Makefile to match @@ -171,18 +168,6 @@ MAGIC_VARIABLE_MAPPING = dict( become_pass=('ansible_become_password', 'ansible_become_pass'), become_exe=('ansible_become_exe', ), become_flags=('ansible_become_flags', ), - - # deprecated - sudo=('ansible_sudo', ), - sudo_user=('ansible_sudo_user', ), - sudo_pass=('ansible_sudo_password', 'ansible_sudo_pass'), - sudo_exe=('ansible_sudo_exe', ), - sudo_flags=('ansible_sudo_flags', ), - su=('ansible_su', ), - su_user=('ansible_su_user', ), - su_pass=('ansible_su_password', 'ansible_su_pass'), - su_exe=('ansible_su_exe', ), - su_flags=('ansible_su_flags', ), ) # POPULATE SETTINGS FROM CONFIG ### diff --git a/lib/ansible/playbook/play_context.py b/lib/ansible/playbook/play_context.py index 2907e32c15..b93cdbc666 100644 --- a/lib/ansible/playbook/play_context.py +++ b/lib/ansible/playbook/play_context.py @@ -292,17 +292,6 @@ class PlayContext(Base): for become_pass_name in C.MAGIC_VARIABLE_MAPPING.get('become_pass'): if become_pass_name in variables: break - else: # This is a for-else - if new_info.become_method == 'sudo': - for sudo_pass_name in C.MAGIC_VARIABLE_MAPPING.get('sudo_pass'): - if sudo_pass_name in variables: - setattr(new_info, 'become_pass', variables[sudo_pass_name]) - break - elif new_info.become_method == 'su': - for su_pass_name in C.MAGIC_VARIABLE_MAPPING.get('su_pass'): - if su_pass_name in variables: - setattr(new_info, 'become_pass', variables[su_pass_name]) - break # make sure we get port defaults if needed if new_info.port is None and C.DEFAULT_REMOTE_PORT is not None: diff --git a/lib/ansible/plugins/shell/__init__.py b/lib/ansible/plugins/shell/__init__.py index c747845b4f..12fd12ca05 100644 --- a/lib/ansible/plugins/shell/__init__.py +++ b/lib/ansible/plugins/shell/__init__.py @@ -39,12 +39,6 @@ class ShellBase(AnsiblePlugin): super(ShellBase, self).__init__() self.env = {} - if C.DEFAULT_MODULE_SET_LOCALE: - module_locale = C.DEFAULT_MODULE_LANG - self.env = {'LANG': module_locale, - 'LC_ALL': module_locale, - 'LC_MESSAGES': module_locale} - self.tmpdir = None self.executable = None