Skip to content

Commit

Permalink
beacons/network_settings.py: Wrong uses of variables
Browse files Browse the repository at this point in the history
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 <alexandru.vasiu@ni.com>
  • Loading branch information
Alexandru Vasiu committed Apr 5, 2019
1 parent 0384824 commit a2bc716
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions salt/beacons/network_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit a2bc716

Please sign in to comment.