From bca7f2fec4836b73748f7a3af863fab748a0d072 Mon Sep 17 00:00:00 2001 From: Vitaly Parakhin Date: Fri, 28 Aug 2015 14:31:58 +0300 Subject: [PATCH] Correct "changing defaults for new envs" behavior By default, if no envs is created, script still should change default repo settings for new environments. Change-Id: I8d2782721c872f4549c01c9a62548200aed8b73a Closes-Bug: #1476857 --- fuel-createmirror | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fuel-createmirror b/fuel-createmirror index 89f50a1..2fac8fc 100755 --- a/fuel-createmirror +++ b/fuel-createmirror @@ -82,12 +82,11 @@ add_repositories_to_nailgun() { local makedefault=" --make-default " local apply=" --apply " [ "$PARTIAL_UPSTREAM" == "0" ] && clearupstream="" - [ "$OPT_NO_DEFAULT" == "1" ] && makedefault="" [ "$OPT_NO_APPLY" == "1" ] && apply="" # find envs with status "new" and with given release_id envs=`env http_proxy="" fuel --user=admin --password="$FUEL_ADMIN_PASS" env 2>&1 | grep -w new | awk -v release_id=$release_id -F'|' '$5 == release_id {print $1}'` for env in ${envs}; do - $EXEC_PREFIX env http_proxy="" fuel-package-updates -d $2 -r $FULL_RELEASE --no-download $makedefault $apply \ + $EXEC_PREFIX env http_proxy="" fuel-package-updates -d $2 -r $FULL_RELEASE --no-download $apply \ -s $FUEL_SERVER -p "$FUEL_ADMIN_PASS" -b http://$FUEL_SERVER:8080/$3 -e $env $clearupstream 2>/dev/null EC_FPU=$? if [[ "$EC_FPU" == "0" ]]; then @@ -96,8 +95,19 @@ add_repositories_to_nailgun() { echo " * INFO: Failed to add repositories for environment id=$env to Nailgun, please add them MANUALLY" EC_ADD=1 fi - [ "$OPT_NO_DEFAULT" ] && echo " * INFO: Default repositories for new environments were not modified" || echo " * INFO: Created repositories were set as defaults for new environments" done + if [ "$OPT_NO_DEFAULT" ]; then + echo " * INFO: Default repositories for new environments were not modified" + else + $EXEC_PREFIX env http_proxy="" fuel-package-updates -d $2 -r $FULL_RELEASE --no-download --make-default \ + -s $FUEL_SERVER -p "$FUEL_ADMIN_PASS" -b http://$FUEL_SERVER:8080/$3 $apply $clearupstream 2>/dev/null + EC_FPU=$? + if [[ "$EC_FPU" == "0" ]]; then + echo " * INFO: Created repositories were set as defaults for new environments" + else + echo " * WARN: Failed to set repositories as defaults for new environments" + fi + fi [ "$EC_ADD" == "1" ] && print_repositories_ubuntu $3 }