From 66229fdf424971cf20f95e34d4873f92da38387b Mon Sep 17 00:00:00 2001 From: Oleksiy Molchanov Date: Fri, 22 Jul 2016 19:34:50 +0300 Subject: [PATCH] Add update-master-node script This script updates master node in fuel 9.x releases. It upgrades system packages, runs fuel/examples/deploy.sh as for boostrap admin node process (puppet tasks run), then restarts all important master node services. Logging for this script is also added. Closes-bug: #1605602 Related-bug: #1616472 Related-bug: #1616393 Change-Id: Ic4ef722b861d260c3679dca9c74f6cc62052c376 --- .../fuel-utils/updates/update-master-node.sh | 66 +++++++++++++++++++ specs/fuel-library10.0.spec | 2 + 2 files changed, 68 insertions(+) create mode 100644 files/fuel-utils/updates/update-master-node.sh diff --git a/files/fuel-utils/updates/update-master-node.sh b/files/fuel-utils/updates/update-master-node.sh new file mode 100644 index 0000000000..ad251551d6 --- /dev/null +++ b/files/fuel-utils/updates/update-master-node.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +set -ex +set -o pipefail + + +# setup logging +[ -d '/var/log/puppet' ] || mkdir -p /var/log/puppet +LOGFILE="${LOGFILE:-/var/log/puppet/update_master_node.log}" + +exec > >(tee -i "${LOGFILE}") +exec 2>&1 + + +echo "Master node update is (log: ${LOGFILE} )" + +echo ': Packages...' +# upgrade packages +yum clean all +yum update -y + +# systemd: load fresh units +systemctl daemon-reload + + +echo ': Puppet...' +# re-apply puppet master node configuration +bash -x /etc/puppet/modules/fuel/examples/deploy.sh + + +echo ': Services...' +# restart services +SERVICES=" +astute +cobblerd +mcollective +nailgun +nginx +openstack-keystone +ostf +rabbitmq-server +oswl_flavor_collectord +oswl_image_collectord +oswl_keystone_user_collectord +oswl_tenant_collectord +oswl_vm_collectord +oswl_volume_collectord +receiverd +statsenderd +assassind +" + +echo "Restarting postgresql..." +systemctl restart postgresql +sleep 32 + +for service in $SERVICES; do + echo "Restarting ${service}..." + systemctl restart "$service" +done + + +echo; echo +echo "Master node update is (log: ${LOGFILE} )" + +exit 0 diff --git a/specs/fuel-library10.0.spec b/specs/fuel-library10.0.spec index 109a6ead72..08ce56075a 100644 --- a/specs/fuel-library10.0.spec +++ b/specs/fuel-library10.0.spec @@ -71,6 +71,7 @@ install -m 0755 %{fuel_utils_source}/dockerctl %{buildroot}/usr/bin install -m 0755 %{fuel_utils_source}/flat_yaml.py %{buildroot}/usr/bin install -m 0644 %{fuel_utils_source}/config %{buildroot}/etc/fuel-utils/config install -m 0644 %{fuel_utils_source}/functions.sh %{buildroot}/usr/share/fuel-utils/functions.sh +install -m 0755 %{fuel_utils_source}/updates/update-master-node.sh %{buildroot}/usr/share/fuel-utils/update-master-node.sh #fuel-misc install -m 0755 %{files_source}/fuel-misc/centos_ifdown-local %{buildroot}/sbin/ifup-local install -m 0755 %{files_source}/fuel-misc/logrotate %{buildroot}/usr/bin/fuel-logrotate @@ -173,6 +174,7 @@ This package contains a set of helpers to maintain Fuel services /usr/bin/fuel-utils /usr/bin/flat_yaml.py /usr/share/fuel-utils/functions.sh +/usr/share/fuel-utils/update-master-node.sh %config(noreplace) /etc/fuel-utils/config