Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Use pynotify instead of inotify-tools #607

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main-packages-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ipmitool
iproute
mod_ssl
procps
python3-inotify
python3-jinja2
qemu-img
sqlite
Expand Down
4 changes: 0 additions & 4 deletions prepare-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ if [[ -n "${EXTRA_PKGS_LIST:-}" ]]; then
fi
fi

dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
dnf config-manager --set-disabled epel
dnf install -y --enablerepo=epel inotify-tools

dnf remove -y --noautoremove 'dnf-command(config-manager)'

# NOTE(elfosardo): we need to reinstall tzdata as the base CS9 container removes
Expand Down
16 changes: 8 additions & 8 deletions scripts/runhttpd
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ fi

# Set up inotify to kill the container (restart) whenever cert files for ironic api change
if [[ "$IRONIC_TLS_SETUP" == "true" ]] && [[ "${RESTART_CONTAINER_CERTIFICATE_UPDATED}" == "true" ]]; then
# shellcheck disable=SC2034
inotifywait -m -e delete_self "${IRONIC_CERT_FILE}" | while read -r file event; do
kill -WINCH $(pgrep httpd)
done &
python3 -m pyinotify -e IN_DELETE_SELF -v "${IRONIC_CERT_FILE}" |
while read -r file event; do
kill -WINCH $(pgrep httpd)
done &
fi

# Set up inotify to kill the container (restart) whenever cert of httpd for /shared/html/<redifsh;ilo> path change
if [[ "$IRONIC_VMEDIA_TLS_SETUP" == "true" ]] && [[ "${RESTART_CONTAINER_CERTIFICATE_UPDATED}" == "true" ]]; then
# shellcheck disable=SC2034
inotifywait -m -e delete_self "${IRONIC_VMEDIA_CERT_FILE}" | while read -r file event; do
kill -WINCH $(pgrep httpd)
done &
python3 -m pyinotify -e IN_DELETE_SELF -v "${IRONIC_VMEDIA_CERT_FILE}" |
while read -r file event; do
kill -WINCH $(pgrep httpd)
done &
fi

exec /usr/sbin/httpd -DFOREGROUND
8 changes: 4 additions & 4 deletions scripts/runironic
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ mkdir -p /shared/log/ironic/deploy
run_ironic_dbsync

if [[ "$IRONIC_TLS_SETUP" == "true" ]] && [[ "${RESTART_CONTAINER_CERTIFICATE_UPDATED}" == "true" ]]; then
# shellcheck disable=SC2034
inotifywait -m -e delete_self "${IRONIC_CERT_FILE}" | while read -r file event; do
kill $(pgrep ironic)
done &
python3 -m pyinotify -e IN_DELETE_SELF -v "${IRONIC_CERT_FILE}" |
while read -r file event; do
kill $(pgrep ironic)
done &
fi

configure_ironic_auth
Expand Down
2 changes: 1 addition & 1 deletion scripts/runlogwatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Ramdisk logs path
LOG_DIR="/shared/log/ironic/deploy"

inotifywait -m "${LOG_DIR}" -e close_write |
python3 -m pyinotify -e IN_CLOSE_WRITE -v "${LOG_DIR}" |
while read -r path _action file; do
echo "************ Contents of ${path}/${file} ramdisk log file bundle **************"
tar -xOzvvf "${path}/${file}" | sed -e "s/^/${file}: /"
Expand Down
Loading