From ea8fc2bdfe6612c16a38b09b2cc1765f72f46ae9 Mon Sep 17 00:00:00 2001 From: Georgy Kibardin Date: Thu, 23 Mar 2017 13:58:21 +0300 Subject: [PATCH] Sync mcollective config with /etc/nailgun_uid The contents of /etc/nailgun_uid can be changed by nailgun agent. We need to synchronize the change to mcollective config. Closes-Bug: #1675668 Change-Id: Idabc7be6181bc89c09e4d0caa4a7cf0c22767bfe --- .../xenial/usr/bin/fix-configs-on-startup | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup b/contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup index 2a375e25..c5ac7ca5 100755 --- a/contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup +++ b/contrib/fuel_bootstrap/files/xenial/usr/bin/fix-configs-on-startup @@ -58,18 +58,30 @@ sed -i "/^\s*server\b/ d" /etc/ntp.conf echo "server $masternode_ip burst iburst" >> /etc/ntp.conf systemctl restart ntp +sync_identity() { + while true + do + if new_identity=$(grep -s --line-regexp "[[:digit:]]\+" /etc/nailgun_uid) + then + if [ "$new_identity" != "$identity" ] + then + identity=$new_identity + sed -i '/^identity =/d' /etc/mcollective/server.cfg > /dev/null 2>&1 + echo "identity = $identity" >> /etc/mcollective/server.cfg + service mcollective restart + fi + fi + sleep 5 + done +} + # # Update mcollective config # sed -i "s/^plugin.rabbitmq.pool.1.host\b.*$/plugin.rabbitmq.pool.1.host = $masternode_ip/" /etc/mcollective/server.cfg sed -i "s/^plugin.rabbitmq.pool.1.user\b.*$/plugin.rabbitmq.pool.1.user = $mco_user/" /etc/mcollective/server.cfg sed -i "s/^plugin.rabbitmq.pool.1.password\b.*$/plugin.rabbitmq.pool.1.password= $mco_pass/" /etc/mcollective/server.cfg -while true; do - sleep 5 - grep --line-regexp "[[:digit:]]\+" /etc/nailgun_uid && break -done -echo "identity = $(head -n 1 /etc/nailgun_uid)" >> /etc/mcollective/server.cfg -service mcollective restart +sync_identity & # restart the dispynode service systemctl restart dispynode