Add error checking in places, set up automatic relay provisioning and fix starting bots
This commit is contained in:
29
commands/auto.py
Normal file
29
commands/auto.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import main
|
||||
from modules import provision
|
||||
|
||||
class AutoCommand:
|
||||
def __init__(self, *args):
|
||||
self.auto(*args)
|
||||
|
||||
def auto(self, addr, authed, data, obj, spl, success, failure, info, incUsage, length):
|
||||
if authed:
|
||||
if length == 3:
|
||||
if not spl[1] in main.network.keys():
|
||||
failure("No such network: %s" % spl[1])
|
||||
return
|
||||
if not spl[2].isdigit():
|
||||
failure("Must be integer, not %s" % spl[2])
|
||||
return
|
||||
|
||||
id, alias = main.network[spl[1]].add_relay(int(spl[2]))
|
||||
success("Successfully created relay %s on network %s with alias %s" % (str(id), spl[1], alias))
|
||||
main.saveConf("network")
|
||||
rtrn = provision.provisionRelay(int(spl[2]), spl[1])
|
||||
success("Started provisioning network %s on relay %s for alias %s" % (spl[1], spl[2], rtrn))
|
||||
return
|
||||
|
||||
else:
|
||||
incUsage("auto")
|
||||
return
|
||||
else:
|
||||
incUsage(None)
|
||||
Reference in New Issue
Block a user