diff --git a/CHANGELOG.md b/CHANGELOG.md index 1345a151ff2..2b4eeb30ca4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Ansible Changes By Release * Fix for 'ansible-vault encrypt' with vault_password_file in config and --ask-vault-pass cli (https://github.com/ansible/ansible/pull/30514#pullrequestreview-63395903) * updated porting guide with notes for callbacks and config * Added backwards compatiblity shim for callbacks that do not inherit from CallbackBase +* Corrected issue with configuration and multiple ini entries being overwriten even when not set. diff --git a/examples/ansible.cfg b/examples/ansible.cfg index 695cf0cec2c..15390588af3 100644 --- a/examples/ansible.cfg +++ b/examples/ansible.cfg @@ -315,7 +315,7 @@ #enable_plugins = host_list, virtualbox, yaml, constructed # ignore these extensions when parsing a directory as inventory source -#ignore_extensions = '.pyc', '.pyo', '.swp', '.bak', '~', '.rpm', '.md', '.txt', '~', '.orig', '.ini', '.cfg', '.retry' +#ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry # ignore files matching these patterns when parsing a directory as inventory source #ignore_patterns= diff --git a/lib/ansible/config/manager.py b/lib/ansible/config/manager.py index 2756d7cdc99..cbf513d9308 100644 --- a/lib/ansible/config/manager.py +++ b/lib/ansible/config/manager.py @@ -292,12 +292,14 @@ class ConfigManager(object): if ftype and defs[config].get(ftype): if ftype == 'ini': # load from ini config - try: # FIXME: generaelize _loop_entries to allow for files also + try: # FIXME: generaelize _loop_entries to allow for files also, most of this code is dupe for ini_entry in defs[config]['ini']: - value = get_ini_config_value(self._parser, ini_entry) - origin = cfile - if value is not None and 'deprecated' in ini_entry: - self.DEPRECATED.append(('[%s]%s' % (ini_entry['section'], ini_entry['key']), ini_entry['deprecated'])) + temp_value = get_ini_config_value(self._parser, ini_entry) + if temp_value is not None: + value = temp_value + origin = cfile + if 'deprecated' in ini_entry: + self.DEPRECATED.append(('[%s]%s' % (ini_entry['section'], ini_entry['key']), ini_entry['deprecated'])) except Exception as e: sys.stderr.write("Error while loading ini config %s: %s" % (cfile, to_native(e))) elif ftype == 'yaml':