Don't return the same thing twice

The add_relay and provisionRelay functions both returned the alias.
Only use the output from one function.
This commit is contained in:
Mark Veidemanis 2019-10-11 13:02:39 +01:00
parent f9619a5bc4
commit 324af04de0
1 changed files with 6 additions and 7 deletions

View File

@ -18,19 +18,18 @@ class AutoCommand:
num, alias = main.network[spl[1]].add_relay(relayNum) num, alias = main.network[spl[1]].add_relay(relayNum)
success("Successfully created relay %i on network %s with alias %s" % (num, spl[1], alias)) success("Successfully created relay %i on network %s with alias %s" % (num, spl[1], alias))
main.saveConf("network") main.saveConf("network")
rtrn = provision.provisionRelay(relayNum, spl[1]) provision.provisionRelay(relayNum, spl[1])
success("Started provisioning network %s on relay %s for alias %s" % (spl[1], spl[2], rtrn)) success("Started provisioning network %s on relay %s for alias %s" % (spl[1], spl[2], alias))
return return
elif length == 2: elif length == 2:
if not spl[1] in main.network.keys(): if not spl[1] in main.network.keys():
failure("No such network: %s" % spl[1]) failure("No such network: %s" % spl[1])
return return
for i in main.alias.keys(): for i in main.alias.keys():
print("num", i)
num, alias = main.network[spl[1]].add_relay(i) num, alias = main.network[spl[1]].add_relay(i)
success("Successfully created relay %i on network %s with alias %s" % (num, spl[1], alias)) success("Successfully created relay %i on network %s with alias %s" % (num, spl[1], alias))
rtrn = provision.provisionRelay(num, spl[1]) provision.provisionRelay(num, spl[1])
success("Started provisioning network %s on relay %s for alias %s" % (spl[1], num, rtrn)) success("Started provisioning network %s on relay %s for alias %s" % (spl[1], num, alias))
main.saveConf("network") main.saveConf("network")
return return
elif length == 1: elif length == 1:
@ -38,8 +37,8 @@ class AutoCommand:
for x in main.alias.keys(): for x in main.alias.keys():
num, alias = main.network[i].add_relay(x) num, alias = main.network[i].add_relay(x)
success("Successfully created relay %i on network %s with alias %s" % (num, i, alias)) success("Successfully created relay %i on network %s with alias %s" % (num, i, alias))
rtrn = provision.provisionRelay(num, i) provision.provisionRelay(num, i)
success("Started provisioning network %s on relay %s for alias %s" % (i, num, rtrn)) success("Started provisioning network %s on relay %s for alias %s" % (i, num, alias))
main.saveConf("network") main.saveConf("network")
return return
else: else: