Skip to content

Commit 99ae86e

Browse files
committed
chore: fmt
1 parent f8c523c commit 99ae86e

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

testinfra/test_ami_nix.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,20 @@ def gzip_then_base64_encode(s: str) -> str:
351351
instance.terminate()
352352
raise TimeoutError("init.sh failed to complete within the timeout period")
353353

354+
# Start fail2ban service before health checks
355+
logger.info("Starting fail2ban service...")
356+
result = run_ssh_command(ssh, "sudo systemctl start fail2ban.service")
357+
if not result["succeeded"]:
358+
logger.warning(f"Failed to start fail2ban: {result['stderr']}")
359+
# Check fail2ban logs for more details
360+
log_result = run_ssh_command(
361+
ssh, "sudo journalctl -u fail2ban -n 20 --no-pager"
362+
)
363+
if log_result["succeeded"]:
364+
logger.warning(f"fail2ban logs:\n{log_result['stdout']}")
365+
else:
366+
logger.info("fail2ban service started successfully")
367+
354368
def is_healthy(ssh) -> bool:
355369
health_checks = [
356370
("postgres", "sudo -u postgres /usr/bin/pg_isready -U postgres"),

0 commit comments

Comments
 (0)