2022-02-05 00:46:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
# Isengard commands
|
|
|
|
|
2022-02-06 01:29:59 +01:00
|
|
|
def cmdping(owners, nick, text, sbuf):
|
2022-02-05 00:46:57 +01:00
|
|
|
"""
|
|
|
|
Ping command.
|
|
|
|
"""
|
|
|
|
|
|
|
|
return "pong !"
|
|
|
|
|
|
|
|
|
2022-02-06 01:29:59 +01:00
|
|
|
def cmdmainteneur(owners, nick, text, sbuf):
|
|
|
|
"""
|
|
|
|
Change maintainer for an host
|
|
|
|
"""
|
|
|
|
|
|
|
|
if not nick in owners:
|
|
|
|
return "désolé mais vous n'êtes pas autorisé à utiliser cette commande."
|
|
|
|
|
|
|
|
try:
|
|
|
|
splittedtext = text.split(" ")
|
|
|
|
|
|
|
|
# print maintainer
|
|
|
|
if len(splittedtext) == 2:
|
|
|
|
host = splittedtext[1]
|
|
|
|
|
|
|
|
return "le responsable de cette machine est " \
|
|
|
|
+ sbuf.buf[host]["maintainer"]
|
|
|
|
|
|
|
|
if len(splittedtext) == 3:
|
|
|
|
host = splittedtext[1]
|
|
|
|
maintainer = splittedtext[2]
|
|
|
|
|
|
|
|
sbuf.buf[host]["maintainer"] = maintainer
|
|
|
|
|
|
|
|
return "le responsable est à présent " \
|
|
|
|
+ sbuf.buf[host]["maintainer"]
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
print(repr(e))
|
|
|
|
return "Erreur à l'exécution"
|
|
|
|
|
|
|
|
return "Syntaxe invalide"
|
2022-02-05 00:46:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Commands
|
|
|
|
|
|
|
|
commandtable = {
|
|
|
|
|
|
|
|
"ping" : cmdping,
|
2022-02-06 01:29:59 +01:00
|
|
|
"mainteneur" : cmdmainteneur,
|
2022-02-05 00:46:57 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|