Only start one relay with the auto command
We only need one initial relay, as ChanKeep will automatically add as many as it needs when receiving a LIST response.
This commit is contained in:
parent
6ad6d6dc50
commit
b97ebe43ab
|
@ -7,38 +7,28 @@ class AutoCommand:
|
||||||
|
|
||||||
def auto(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
def auto(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
||||||
if authed:
|
if authed:
|
||||||
if length == 3:
|
if length == 1:
|
||||||
if not spl[1] in main.network.keys():
|
for i in main.network.keys():
|
||||||
failure("No such network: %s" % spl[1])
|
if 1 in main.network[i].relays.keys():
|
||||||
return
|
info("Skipping %s - first relay exists" % i)
|
||||||
if not spl[2].isdigit():
|
else:
|
||||||
failure("Must be a number, not %s" % spl[2])
|
num, alias = main.network[i].add_relay(1)
|
||||||
return
|
success("Successfully created first relay on network %s with alias %s" % (i, alias))
|
||||||
relayNum = int(spl[2])
|
provision.provisionRelay(num, i)
|
||||||
num, alias = main.network[spl[1]].add_relay(relayNum)
|
success("Started provisioning network %s on first relay for alias %s" % (i, alias))
|
||||||
success("Successfully created relay %i on network %s with alias %s" % (num, spl[1], alias))
|
|
||||||
main.saveConf("network")
|
main.saveConf("network")
|
||||||
provision.provisionRelay(relayNum, spl[1])
|
|
||||||
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():
|
if 1 in main.network[spl[1]].relays.keys():
|
||||||
num, alias = main.network[spl[1]].add_relay(i)
|
failure("First relay exists on %s" % spl[1])
|
||||||
success("Successfully created relay %i on network %s with alias %s" % (num, spl[1], alias))
|
return
|
||||||
provision.provisionRelay(num, spl[1])
|
num, alias = main.network[spl[1]].add_relay(1)
|
||||||
success("Started provisioning network %s on relay %s for alias %s" % (spl[1], num, alias))
|
success("Successfully created relay %i on network %s with alias %s" % (num, spl[1], alias))
|
||||||
main.saveConf("network")
|
provision.provisionRelay(num, spl[1])
|
||||||
return
|
success("Started provisioning network %s on relay %s for alias %s" % (spl[1], num, alias))
|
||||||
elif length == 1:
|
|
||||||
for i in main.network.keys():
|
|
||||||
for x in main.alias.keys():
|
|
||||||
num, alias = main.network[i].add_relay(x)
|
|
||||||
success("Successfully created relay %i on network %s with alias %s" % (num, i, alias))
|
|
||||||
provision.provisionRelay(num, i)
|
|
||||||
success("Started provisioning network %s on relay %s for alias %s" % (i, num, alias))
|
|
||||||
main.saveConf("network")
|
main.saveConf("network")
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
"relay": "relay <add|del|list> [<network>] [<num>]",
|
"relay": "relay <add|del|list> [<network>] [<num>]",
|
||||||
"network": "network <add|del|list> [<name> <address> <port> <ssl|plain> <sasl|ns|none>]",
|
"network": "network <add|del|list> [<name> <address> <port> <ssl|plain> <sasl|ns|none>]",
|
||||||
"alias": "alias [<add|del>] [<num>]",
|
"alias": "alias [<add|del>] [<num>]",
|
||||||
"auto": "auto [<network>] [<relay>]",
|
"auto": "auto [<network>]",
|
||||||
"cmd": "cmd <relay> <user> <entity> <text ...>",
|
"cmd": "cmd <relay> <user> <entity> <text ...>",
|
||||||
"token": "token <add|del|list> [<key>] [<relay>]",
|
"token": "token <add|del|list> [<key>] [<relay>]",
|
||||||
"all": "all <entity> <text ...>",
|
"all": "all <entity> <text ...>",
|
||||||
|
|
Loading…
Reference in New Issue