Commit 2618b443 authored by Simon Redman's avatar Simon Redman

Prevent adding IP addresses from failing if run twice

parent 91f0b2aa
...@@ -205,7 +205,19 @@ def add_ULAs_to_hosts(netgraph, ULA_map): ...@@ -205,7 +205,19 @@ def add_ULAs_to_hosts(netgraph, ULA_map):
for host_idx in range(len(hostnames)): for host_idx in range(len(hostnames)):
script = scripts[host_idx].format( script = scripts[host_idx].format(
commands.append(SCRIPT_PUSH_AND_EXEC_COMMAND_TEMPLATE.format(script=script)) commands.append(SCRIPT_PUSH_AND_EXEC_COMMAND_TEMPLATE.format(script=script))
ssh_helper.run_commands_on_many_hosts(sessions, commands) try:
ssh_helper.run_commands_on_many_hosts(sessions, commands)
except ssh_helper.SSHCommandErrorError as e:
# If the script is being re-run, the nodes will already have the correct IP addresses, which will case an error
while e is not None:
output = str.join(' ', e.output.splitlines()) # Get rid of newlines
if "RTNETLINK answers: File exists" in output:
# No problem
e =
def add_interfaces_to_netgraph(netgraph, ULA_map): def add_interfaces_to_netgraph(netgraph, ULA_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