Browse code

dont override previous ini entries with defaults

corrected setting example, quotes mess up the regex
fixes #30633

Brian Coca authored on 2017/09/21 00:59:55
Showing 2 changed files
... ...
@@ -315,7 +315,7 @@
315 315
 #enable_plugins = host_list, virtualbox, yaml, constructed
316 316
 
317 317
 # ignore these extensions when parsing a directory as inventory source
318
-#ignore_extensions = '.pyc', '.pyo', '.swp', '.bak', '~', '.rpm', '.md', '.txt', '~', '.orig', '.ini', '.cfg', '.retry'
318
+#ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry
319 319
 
320 320
 # ignore files matching these patterns when parsing a directory as inventory source
321 321
 #ignore_patterns=
... ...
@@ -292,12 +292,14 @@ class ConfigManager(object):
292 292
             if ftype and defs[config].get(ftype):
293 293
                 if ftype == 'ini':
294 294
                     # load from ini config
295
-                    try:  # FIXME: generaelize _loop_entries to allow for files also
295
+                    try:  # FIXME: generaelize _loop_entries to allow for files also, most of this code is dupe
296 296
                         for ini_entry in defs[config]['ini']:
297
-                            value = get_ini_config_value(self._parser, ini_entry)
298
-                            origin = cfile
299
-                            if value is not None and 'deprecated' in ini_entry:
300
-                                self.DEPRECATED.append(('[%s]%s' % (ini_entry['section'], ini_entry['key']), ini_entry['deprecated']))
297
+                            temp_value = get_ini_config_value(self._parser, ini_entry)
298
+                            if temp_value is not None:
299
+                                value = temp_value
300
+                                origin = cfile
301
+                                if 'deprecated' in ini_entry:
302
+                                    self.DEPRECATED.append(('[%s]%s' % (ini_entry['section'], ini_entry['key']), ini_entry['deprecated']))
301 303
                     except Exception as e:
302 304
                         sys.stderr.write("Error while loading ini config %s: %s" % (cfile, to_native(e)))
303 305
                 elif ftype == 'yaml':