mirror of https://github.com/fail2ban/fail2ban
Added transmitter get cinfo option for action
parent
b6a68f5138
commit
b36835f6f0
|
@ -90,6 +90,7 @@ protocol = [
|
|||
["get <JAIL> actioncheck <ACT>", "gets the check command for the action <ACT> for <JAIL>"],
|
||||
["get <JAIL> actionban <ACT>", "gets the ban command for the action <ACT> for <JAIL>"],
|
||||
["get <JAIL> actionunban <ACT>", "gets the unban command for the action <ACT> for <JAIL>"],
|
||||
["get <JAIL> cinfo <ACT> <KEY>", "gets the value for <KEY> for the action <ACT> for <JAIL>"],
|
||||
]
|
||||
|
||||
##
|
||||
|
|
|
@ -266,6 +266,10 @@ class Transmitter:
|
|||
elif command[1] == "actionunban":
|
||||
act = command[2]
|
||||
return self.__server.getActionUnban(name, act)
|
||||
elif command[1] == "cinfo":
|
||||
act = command[2]
|
||||
key = command[3]
|
||||
return self.__server.getCInfo(name, act, key)
|
||||
raise Exception("Invalid command (no get action or not yet implemented)")
|
||||
|
||||
def status(self, command):
|
||||
|
|
|
@ -422,13 +422,14 @@ class Transmitter(unittest.TestCase):
|
|||
self.__transm.proceed(
|
||||
["set", self.jailName, "setcinfo", action, "KEY", "VALUE"]),
|
||||
(0, "VALUE"))
|
||||
#TODO: Implement below in server.transmitter?
|
||||
"""
|
||||
self.assertEqual(
|
||||
self.__transm.proceed(
|
||||
["get", self.jailName, "cinfo", action, "KEY"]),
|
||||
(0, "VALUE"))
|
||||
"""
|
||||
self.assertEqual(
|
||||
self.__transm.proceed(
|
||||
["get", self.jailName, "cinfo", action, "InvalidKey"])[0],
|
||||
1)
|
||||
self.assertEqual(
|
||||
self.__transm.proceed(
|
||||
["set", self.jailName, "delcinfo", action, "KEY"]),
|
||||
|
|
Loading…
Reference in New Issue