Commit 6732d9b8 authored by Simon Redman's avatar Simon Redman

Remove global-scope variable bugs

parent 372b2573
......@@ -53,7 +53,7 @@ def parse_ipv4_networks(netgraph):
commands.append(IPV4_COMMAND)
outputs = ssh_helper.run_commands_on_many_hosts(sessions, commands)
for host_idx in range(len(hostnames)):
for host_idx in range(len(hosts)):
# Split the output of the `ip` command per-interface. It comes in as a numbered list, so split on the numbers
interface_lines = re.split(r'\s[0-9]+:\s', outputs[host_idx])
# Dump the first line since it is the echo of the command we sent
......@@ -69,7 +69,7 @@ def parse_ipv4_networks(netgraph):
ipaddr = re.findall(r'\sinet\s+(.*?)\s+brd.*scope global', remainder[0])
assert len(ipaddr) == 1, "Should only have found one link-local address!"
ipaddr = ipaddress.ip_interface(ipaddr[0])
interface_map[hostnames[host_idx]][interface_name] = ipaddr
interface_map[hosts[host_idx]][interface_name] = ipaddr
return interface_map
......@@ -93,7 +93,7 @@ def parse_local_interface_addresses(netgraph):
commands.append(LINK_LOCAL_COMMAND)
outputs = ssh_helper.run_commands_on_many_hosts(sessions, commands)
for host_idx in range(len(hostnames)):
for host_idx in range(len(hosts)):
# Split the output of the `ip` command per-interface. It comes in as a numbered list, so split on the numbers
interface_lines = re.split(r'\s[0-9]+:\s', outputs[host_idx])
# Dump the first line since it is the echo of the command we sent
......@@ -109,7 +109,7 @@ def parse_local_interface_addresses(netgraph):
ipaddr = re.findall(r'\sinet6\s+(.*?)\s+scope link', remainder[0])
assert len(ipaddr) == 1, "Should only have found one link-local address!"
ipaddr = ipaddress.ip_interface(ipaddr[0])
interface_map[hostnames[host_idx]][interface_name] = ipaddr
interface_map[hosts[host_idx]][interface_name] = ipaddr
return interface_map
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment