add install of dependencies for cleanup-heat 01/5701/2
authorafenner <andrew.fenner@est.tech>
Thu, 13 Aug 2020 09:46:02 +0000 (10:46 +0100)
committerafenner <andrew.fenner@est.tech>
Thu, 13 Aug 2020 10:05:55 +0000 (11:05 +0100)
because cleanup is run on a timed bases I think the build server was fresh so virtualenv was missing
see failed build https://jenkins.nordix.org/view/all/job/cloud-infra-cleanup-stack-city/1/console

Change-Id: I53917fc8186119695188db9d6436e8ade9aaa4cb
Signed-off-by: afenner <andrew.fenner@est.tech>
jjb/cloud-infra/scripts/cleanup-heat-stacks.sh

index d9e49b9c3866da6054e3c2d1819c5092d10c8d74..13523be8412d6eb869c880cc23900fecd0bf3626 100644 (file)
@@ -22,6 +22,27 @@ set -o nounset
 set -o errexit
 set -o pipefail
 
+#-------------------------------------------------------------------------------
+# In some cases, it is useful to see all the output generated by commands so
+# this function makes it possible for users to achieve that by not redirecting
+# output to /dev/null when verbosity is enabled
+#-------------------------------------------------------------------------------
+redirect_cmd() {
+
+  if [[ "$VERBOSITY" == "false" ]]; then
+    "$@" > /dev/null 2>&1
+  else
+    "$@"
+  fi
+
+}
+
+VERBOSITY=${VERBOSITY:-false}
+# ensure dependencies are present
+echo "Info  : Install python3.7-minimal python3-distutils virtualenv using apt"
+redirect_cmd sudo apt update
+redirect_cmd sudo apt install -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confnew -y python3.7-minimal python3-distutils virtualenv
+
 # prepare venv for openstack cli
 /bin/rm -rf $WORKSPACE/.venv
 virtualenv --python python3 --never-download $WORKSPACE/.venv