Skip to content

Commit c3887d8

Browse files
committed
Use clearer Fail2ban asynchat workaround
1 parent aa308f9 commit c3887d8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

bash/ss-install-fail2ban-packages.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ ss_apt_upgrade
8787
## https://github.com/fail2ban/fail2ban/issues/3755
8888
## https://support.plesk.com/hc/en-us/articles/23560932208535-Fail2ban-does-not-start-on-a-Plesk-server-with-Ubuntu-24-No-module-named-asynchat
8989

90-
## install asynchat compatibility package only if missing on ubuntu 24.04 ##
90+
## check if ubuntu 24.04 needs the asynchat compatibility workaround ##
9191
if [[ "${SYSTEM_UBUNTU_VERSION}" == "24.04" ]]; then
92-
if ! python3 -c "import asynchat" > /dev/null 2>&1; then
92+
93+
PYTHON_ASYNCHAT_STATUS=$(python3 -c "import asynchat" > /dev/null 2>&1; echo "$?")
94+
95+
## install asynchat compatibility package only if missing ##
96+
if [[ "${PYTHON_ASYNCHAT_STATUS}" != "0" ]]; then
9397
ss_apt_install python3-pip
9498
python3 -m pip install pyasynchat --break-system-packages
9599
fi
100+
96101
fi
97102

98103
ss_apt_install fail2ban

0 commit comments

Comments
 (0)