Skip to content

Commit

Permalink
Reload Ironic to get the new certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
namnx228 committed Mar 29, 2021
1 parent 255174b commit 5762b61
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions ironic-packages-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ python3-sushy
python3-sushy-oem-idrac
qemu-img
syslinux-nonlinux
inotify-tools
7 changes: 7 additions & 0 deletions ironic-scripts/runironic-api
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,12 @@ done

python3 -c 'import os; import sys; import jinja2; sys.stdout.write(jinja2.Template(sys.stdin.read()).render(env=os.environ))' < /etc/httpd-ironic-api.conf.j2 > /etc/httpd/conf.d/ironic.conf
sed -i "/Listen 80/c\#Listen 80" /etc/httpd/conf/httpd.conf

if [ "$IRONIC_TLS_SETUP" == "true" ]; then
inotifywait -m -e delete_self "${IRONIC_CERT_FILE}" | while read file event; do
/usr/sbin/httpd -k graceful
done &
fi

exec /usr/sbin/httpd -DFOREGROUND

7 changes: 7 additions & 0 deletions ironic-scripts/runironic-conductor
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@ until ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade; do
echo "WARNING: ironic-dbsync failed, retrying"
sleep 1
done

if [ "$IRONIC_TLS_SETUP" == "true" ]; then
inotifywait -m -e delete_self "${IRONIC_CERT_FILE}" | while read file event; do
kill $(pgrep ironic)
done &
fi

exec /usr/bin/ironic-conductor
8 changes: 7 additions & 1 deletion ironic-scripts/runmariadb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ fi

ln -sf /proc/self/fd/1 /var/log/mariadb/mariadb.log

# Restart mysqld when the certificate is updated
if [ -f "$MARIADB_CERT_FILE" ]; then
inotifywait -m -e delete_self "${MARIADB_CERT_FILE}" | while read file event; do
kill $(pgrep mysqld)
done &
fi

if [ ! -d "${DATADIR}/mysql" ]; then
crudini --set "$MARIADB_CONF_FILE" mysqld max_connections 64
crudini --set "$MARIADB_CONF_FILE" mysqld max_heap_table_size 1M
Expand All @@ -44,7 +51,6 @@ DROP DATABASE IF EXISTS test ;
CREATE DATABASE IF NOT EXISTS ironic ;
FLUSH PRIVILEGES ;
EOSQL

# mysqld_safe closes stdout/stderr if no bash options are set ($- == '')
# turn on tracing to prevent this
exec bash -x /usr/bin/mysqld_safe --init-file /tmp/configure-mysql.sql
Expand Down
4 changes: 2 additions & 2 deletions prepare-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

set -euxo pipefail

dnf install -y python3 python3-requests
dnf install -y python3 python3-requests epel-release
curl https://raw.githubusercontent.com/openstack/tripleo-repos/master/tripleo_repos/main.py | python3 - -b master current-tripleo
dnf upgrade -y
dnf update -y && dnf upgrade -y
xargs -rtd'\n' dnf --setopt=install_weak_deps=False install -y < /tmp/${PKGS_LIST}
if [[ ! -z ${EXTRA_PKGS_LIST:-} ]]; then
if [[ -s /tmp/${EXTRA_PKGS_LIST} ]]; then
Expand Down

0 comments on commit 5762b61

Please sign in to comment.