From a2bc7164acdf5d7adcc5a1f52a9d826b2a23cf4e Mon Sep 17 00:00:00 2001 From: Alexandru Vasiu Date: Fri, 5 Apr 2019 16:11:07 +0300 Subject: [PATCH] beacons/network_settings.py: Wrong uses of variables Variable 'interface' was used twice in same context with different scopes and _config['interfaces'] should be updated, instead of _config, with matched interfaces from expanded_config. Signed-off-by: Alexandru Vasiu --- salt/beacons/network_settings.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/salt/beacons/network_settings.py b/salt/beacons/network_settings.py index 3f2ee042d6d4..0f06c999ff5a 100644 --- a/salt/beacons/network_settings.py +++ b/salt/beacons/network_settings.py @@ -163,17 +163,14 @@ def beacon(config): else: # No direct match, try with * wildcard regexp interface_regexp = interface.replace('*', '[0-9]+') - for interface in _stats: - match = re.search(interface_regexp, interface) + for _interface in _stats: + match = re.search(interface_regexp, _interface) if match: interfaces.append(match.group()) - expanded_config[match.group()] = config['interfaces'][interface] + expanded_config[match.group()] = _config['interfaces'][interface] if expanded_config: - config.update(expanded_config) - - # config updated so update _config - list(map(_config.update, config)) + _config['interfaces'].update(expanded_config) log.debug('interfaces %s', interfaces) for interface in interfaces: