mirror of https://github.com/fail2ban/fail2ban
fixes beautifier `get` `ignoreip` (explicit convert to string)
parent
bf4903538d
commit
3ce6f344e3
|
@ -212,8 +212,8 @@ class Beautifier:
|
|||
else:
|
||||
msg = "These IP addresses/networks are ignored:\n"
|
||||
for ip in response[:-1]:
|
||||
msg += "|- " + ip + "\n"
|
||||
msg += "`- " + response[-1]
|
||||
msg += "|- " + str(ip) + "\n"
|
||||
msg += "`- " + str(response[-1])
|
||||
elif inC[2] in ("failregex", "addfailregex", "delfailregex",
|
||||
"ignoreregex", "addignoreregex", "delignoreregex"):
|
||||
if len(response) == 0:
|
||||
|
|
|
@ -25,7 +25,7 @@ import unittest
|
|||
|
||||
from ..client.beautifier import Beautifier
|
||||
from ..version import version
|
||||
from ..server.ipdns import IPAddr
|
||||
from ..server.ipdns import IPAddr, FileIPAddrSet
|
||||
from ..exceptions import UnknownJailException, DuplicateJailException
|
||||
|
||||
class BeautifierTest(unittest.TestCase):
|
||||
|
@ -297,6 +297,13 @@ class BeautifierTest(unittest.TestCase):
|
|||
output += "`- 10.0.2.1"
|
||||
self.assertEqual(self.b.beautify(response), output)
|
||||
|
||||
def testIgnoreIPFile(self):
|
||||
self.b.setInputCmd(["set", "sshd", "addignoreip"])
|
||||
response = [FileIPAddrSet("/test/file-ipaddr-set")]
|
||||
output = ("These IP addresses/networks are ignored:\n"
|
||||
"`- file://test/file-ipaddr-set")
|
||||
self.assertEqual(self.b.beautify(response), output)
|
||||
|
||||
def testFailRegex(self):
|
||||
self.b.setInputCmd(["get", "sshd", "failregex"])
|
||||
output = "No regular expression is defined"
|
||||
|
|
Loading…
Reference in New Issue