diff --git a/tests/test_fail2ban.py b/tests/test_fail2ban.py index 16f15db21a8f7d5de0568deaf2f5629b0ae7803a..80436ea42cb6aa4fe67ca7f7e92013a79bd4b5fc 100755 --- a/tests/test_fail2ban.py +++ b/tests/test_fail2ban.py @@ -69,8 +69,10 @@ def get_jails() -> list: :rtype: list """ - _, output = u.exec_cmd(["fail2ban-client status | grep 'Jail list'"]) - jails = output.split(":")[1].replace(" ", "").split(",") + _, output = u.exec_cmd( + "fail2ban-client status | grep 'Jail list'", log_output=False + ) + jails = output.split(":")[1].strip().replace(" ", "").split(",") return jails @@ -85,12 +87,13 @@ def check_jail_banned(name: str) -> int: """ _, output = u.exec_cmd( - "fail2ban-client status {} | grep 'Currently banned'".format(name) + "fail2ban-client status {} | grep 'Currently banned'".format(name), + log_output=False, ) - banned = output.split(":")[1].replace(" ", "") + banned = output.split(":")[1].strip() if banned: - return banned + return int(banned) return 0