From 0bf6407914dca4feda77620a0ef2b8f69ddfe72d Mon Sep 17 00:00:00 2001 From: Weezer Su Date: Mon, 30 Jan 2017 21:53:43 -0600 Subject: [PATCH] Grab the ubuntu release version from VMs Grab the ubuntu release version from VMs, then feed the VMs with right sources.list file. Change-Id: Iaf89716af1248676fbf2b735dd705a285e6cdf8b --- multi-node-aio/deploy-vms.sh | 5 ++++- multi-node-aio/setup-cobbler.sh | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/multi-node-aio/deploy-vms.sh b/multi-node-aio/deploy-vms.sh index b3a9e8dd..405ee8b5 100755 --- a/multi-node-aio/deploy-vms.sh +++ b/multi-node-aio/deploy-vms.sh @@ -54,6 +54,9 @@ for i in $(apt-key list | awk '/pub/ {print $2}' | awk -F'/' '{print $2}'); do apt-key export "$i" > "/tmp/keys/$i" done +# Get the ubuntu release version from VMs. +RELEASE_VERSION=`ssh -q -o StrictHostKeyChecking=no 10.0.0.100 "lsb_release -sr"` + # Ensure that all running VMs have an updated apt-cache with keys for node in $(get_all_hosts); do ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mkdir -p /tmp/keys" @@ -62,7 +65,7 @@ for node in $(get_all_hosts); do scp "$i" "10.0.0.${node#*":"}:$i" fi done - if [[ "14.04" != "$(lsb_release -sr)" ]]; then + if [[ "14.04" != "${RELEASE_VERSION:0:5}" ]]; then ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "mv /tmp/sources.list /etc/apt/sources.list" fi ssh -q -n -f -o StrictHostKeyChecking=no 10.0.0.${node#*":"} "(for i in /tmp/keys/*; do \ diff --git a/multi-node-aio/setup-cobbler.sh b/multi-node-aio/setup-cobbler.sh index 8a12b9c4..3b033a9a 100755 --- a/multi-node-aio/setup-cobbler.sh +++ b/multi-node-aio/setup-cobbler.sh @@ -60,7 +60,7 @@ chown www-data /var/lib/cobbler/webui_sessions # when templated replace \$ with $ cp -v templates/dhcp.template /etc/cobbler/dhcp.template -# Create a trusty sources file +# Create a sources.list file if [[ "14.04.4" == $DEFAULT_IMAGE ]]; then cp -v templates/trusty-sources.list /var/www/html/trusty-sources.list else