From 561e1f5ba201e11e813c69eb794d0f9f60560dcb 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 (cherry picked from commit ea8fc2bdfe6612c16a38b09b2cc1765f72f46ae9) --- .../xenial/usr/bin/fix-configs-on-startup | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 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 a56dc271..dee5b786 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,19 +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 -rm -f /etc/nailgun-agent/nodiscover # this will be removed as soon as new nailgun agent is committed -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 & # starting distributed serialization worker /usr/bin/dask-worker --nprocs=`nproc` --nthreads 1 @MASTER_NODE_IP@:8002