dont override previous ini entries with defaults

corrected setting example, quotes mess up the regex
fixes #30633
pull/30650/head
Brian Coca 7 years ago committed by Brian Coca
parent 131d417c7a
commit d3e85bd045

@ -315,7 +315,7 @@
#enable_plugins = host_list, virtualbox, yaml, constructed #enable_plugins = host_list, virtualbox, yaml, constructed
# ignore these extensions when parsing a directory as inventory source # 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 files matching these patterns when parsing a directory as inventory source
#ignore_patterns= #ignore_patterns=

@ -292,12 +292,14 @@ class ConfigManager(object):
if ftype and defs[config].get(ftype): if ftype and defs[config].get(ftype):
if ftype == 'ini': if ftype == 'ini':
# load from ini config # 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']: for ini_entry in defs[config]['ini']:
value = get_ini_config_value(self._parser, ini_entry) temp_value = get_ini_config_value(self._parser, ini_entry)
origin = cfile if temp_value is not None:
if value is not None and 'deprecated' in ini_entry: value = temp_value
self.DEPRECATED.append(('[%s]%s' % (ini_entry['section'], ini_entry['key']), ini_entry['deprecated'])) 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: except Exception as e:
sys.stderr.write("Error while loading ini config %s: %s" % (cfile, to_native(e))) sys.stderr.write("Error while loading ini config %s: %s" % (cfile, to_native(e)))
elif ftype == 'yaml': elif ftype == 'yaml':

Loading…
Cancel
Save