Implement a dist command

This commit is contained in:
Mark Veidemanis 2017-12-03 18:34:56 +00:00
parent 77928dc52c
commit 63396d54e3
3 changed files with 13 additions and 3 deletions

View File

@ -7,13 +7,12 @@
"UsePassword": true, "UsePassword": true,
"ConnectOnCreate": false, "ConnectOnCreate": false,
"HighlightNotifications": true, "HighlightNotifications": true,
"DistEnabled": true,
"Password": "s", "Password": "s",
"Default": { "Default": {
"password": null, "password": null,
"username": null, "username": null,
"authtype": null "authtype": null
}, },
"Keywords": [],
"KeywordsExcept": {},
"Master": [] "Master": []
} }

View File

@ -10,5 +10,7 @@
"enable": "enable <name", "enable": "enable <name",
"disable": "disable <name>", "disable": "disable <name>",
"list": "list", "list": "list",
"rehash": "rehash" "rehash": "rehash",
"rekey": "rekey",
"dist": "dist"
} }

View File

@ -8,6 +8,7 @@ from twisted.words.protocols.irc import IRCClient
from json import load, dump, loads from json import load, dump, loads
from sys import exit from sys import exit
from subprocess import run, PIPE
listener = None listener = None
connections = {} connections = {}
@ -467,6 +468,14 @@ class Helper(object):
log("Keyword configuration rehashed") log("Keyword configuration rehashed")
success("Keyword configuration rehashed successfully") success("Keyword configuration rehashed successfully")
elif cmd == "dist":
if config["DistEnabled"]:
rtrn = run(["./dist.sh"], shell=True, stdout=PIPE)
info("Exit code: %s -- Stdout: %s" % (rtrn.returncode, rtrn.stdout))
else:
failure("The dist command is not enabled")
return
elif cmd == "pass": elif cmd == "pass":
info("You are already authenticated") info("You are already authenticated")
return return