From c8f1af0bcf5abcd4f50ddbb044e2c1269f6299d3 Mon Sep 17 00:00:00 2001 From: Weezer Su Date: Thu, 20 Oct 2016 16:13:46 -0500 Subject: [PATCH] Remove the expired key and opensuse repo after cobbler being installed Remove the opensuse expired key and opensuse cobbler repo after cobbler being installed. OSA deployment doesn't need it. And fix a typo and a link of README.rst Change-Id: I24f5d823806f039d879dd69762b2eac3a6005628 --- multi-node-aio/README.rst | 4 ++-- multi-node-aio/functions.rc | 11 +++++++++++ multi-node-aio/setup-cobbler.sh | 8 ++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/multi-node-aio/README.rst b/multi-node-aio/README.rst index f8ef172a..1984a48d 100644 --- a/multi-node-aio/README.rst +++ b/multi-node-aio/README.rst @@ -94,7 +94,7 @@ Notes The cobbler and pre-seed setup has been implemented using some of the awesome work originally created by James Thorne. * cobbler installation post - https://thornelabs.net/2015/11/26/install-and-configure-cobbler-on-ubuntu-1404.html - * pre-seeds -- https://github.com/jameswthorne/preseeds-rpc + * pre-seeds -- https://github.com/jameswthorne/preseeds Options @@ -136,7 +136,7 @@ Instruct the system do all of the cobbler setup: Instruct the system do all of the virsh network setup: ``SETUP_VIRSH_NET=${SETUP_VIRSH_NET:-true}`` -Instruct the system to run the OSA playbooks, if you want to deploy other OSA powered cloud, you can set it to false.: +Instruct the system to run the OSA playbooks, if you want to deploy other OSA powered cloud, you can set it to false: ``RUN_OSA=${RUN_OSA:-true}`` diff --git a/multi-node-aio/functions.rc b/multi-node-aio/functions.rc index f0cd2d6b..0eb8d989 100755 --- a/multi-node-aio/functions.rc +++ b/multi-node-aio/functions.rc @@ -228,3 +228,14 @@ echo -e "Run Time = ${REPORT_OUTPUT}" set -e } +# Return 1 if the second argument is a substring of the first argument, otherwise return 0 +contains() { + string="$1" + substring="$2" + if test "${string#*$substring}" == "$string" + then + echo 0 # $substring is not in $string + else + echo 1 # $substring is in $string + fi +} diff --git a/multi-node-aio/setup-cobbler.sh b/multi-node-aio/setup-cobbler.sh index e2366345..5349d5fb 100755 --- a/multi-node-aio/setup-cobbler.sh +++ b/multi-node-aio/setup-cobbler.sh @@ -143,3 +143,11 @@ done # Restart XinetD service xinetd stop service xinetd start + +# Remove the expired key and opensuse repo, no need after the cobbler being set up. +aptkey_mesg=$(apt-key list) +if [[ $(contains "$aptkey_mesg" "expired") -gt 0 ]]; then + expired_key=$(echo "$aptkey_mesg" | awk /expired/'{print $ sub(".*\/", "")}') + apt-key del $expired_key + add-apt-repository --remove "deb http://download.opensuse.org/repositories/home:/libertas-ict:/cobbler26/xUbuntu_14.04/ ./" +fi