update bios in parallel and detect shipyard errors 09/1909/1
authordavidplunkett <dp7642@att.com>
Mon, 4 Nov 2019 20:34:23 +0000 (20:34 +0000)
committerdavidplunkett <dp7642@att.com>
Mon, 4 Nov 2019 20:34:23 +0000 (20:34 +0000)
Run bios updates on other master and worker nodes in background
while OS is being installed on genesis node.

Improve shipyard deploy failure logic to exit on failed steps or
malformed shipyard cli commands.

Signed-off-by: davidplunkett <dp7642@att.com>
Change-Id: I3fb5f9b6b2d13c44f579abc1ea280c8c87ffdbeb

tools/2genesis.sh
tools/deploy_site.sh

index ca1941e..dca7c91 100755 (executable)
@@ -44,11 +44,16 @@ fi
 source $(dirname $0)/env_$SITE.sh
 
 cd $YAML_BUILDS
-# Install OS on Genesis
+
+FILENAME=$(mktemp)
+echo "# Updating BIOS settings on master and worker nodes in background [$FILENAME]"
+python $YAML_BUILDS/scripts/update_bios_settings.py $SITE.yaml >$FILENAME &
+
+echo "# Install OS on Genesis"
 python $YAML_BUILDS/scripts/jcopy.py $SITE.yaml $YAML_BUILDS/tools/j2/serverrc.j2 $YAML_BUILDS/tools/"$GENESIS_NAME"rc
 /opt/akraino/redfish/install_server_os.sh --rc /opt/akraino/yaml_builds/tools/"$GENESIS_NAME"rc --skip-confirm
 
-# Stage Airship files on Genesis
+echo "# Stage Airship files on Genesis"
 scp $YAML_BUILDS/tars/promenade-bundle-$SITE.tar $GENESIS_HOST:/tmp/
 ssh $GENESIS_HOST << EOF
   # TODO avoid following hard coding$
@@ -60,10 +65,14 @@ ssh $GENESIS_HOST << EOF
   mv configs/promenade-bundle/deploy_site.sh .
 EOF
 
-# Update BIOS settings on master and worker nodes
-python $YAML_BUILDS/scripts/update_bios_settings.py $SITE.yaml
+echo "# Waiting for BIOS updates to finish on master and worker nodes"
+wait
+# Show output from BIOS updates on master and worker nodes
+cat $FILENAME
+rm $FILENAME
 
 echo "#######################################"
 echo "# $0 finished"
 echo "#######################################"
 #pkill -9 $$ && exit 0
+
index b4611ee..f297cb9 100755 (executable)
@@ -51,7 +51,7 @@ echo "## MaaS GUI    -> $MAAS_URL"
 echo "## Shipyard cli-> $SHIPYARD_CLI"
 #echo "## Airflow GUI -> $AIRFLOW_URL"
 
-while ( ! $SHIPYARD_CLI | grep -qe '^Lifecycle.*Complete' && ! $SHIPYARD_CLI | grep -qe '^step.*failed'); do
+while ( ! $SHIPYARD_CLI | grep -qe '^Lifecycle.*Complete' && ! $SHIPYARD_CLI | grep -qe '^step.*failed' && ! $SHIPYARD_CLI | grep -qe '^Usage:' ); do
   $SHIPYARD_CLI
   echo "## Sleeping for 10 mins"
   sleep 600
@@ -60,4 +60,5 @@ $SHIPYARD_CLI
 
 exec 2>&-
 exec 1>&-
-$SHIPYARD_CLI | grep -qe '^step.*failed'
+$SHIPYARD_CLI 2>&1 | grep -qPe 'failed|Usage:'
+exit $((! $?))