X-Git-Url: https://gerrit.nordix.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=jjb%2Fcloud-infra%2Fscripts%2Fcleanup-heat-stacks.sh;h=817499bf50282bd104fb91de29b24b06dc45da2f;hb=3b5d5d8f359a4207872edf32773fdb72c3193eb7;hp=d9e49b9c3866da6054e3c2d1819c5092d10c8d74;hpb=7089c7f8f6808f244b87968571b4830e902abd35;p=infra%2Fcicd.git diff --git a/jjb/cloud-infra/scripts/cleanup-heat-stacks.sh b/jjb/cloud-infra/scripts/cleanup-heat-stacks.sh index d9e49b9c..817499bf 100644 --- a/jjb/cloud-infra/scripts/cleanup-heat-stacks.sh +++ b/jjb/cloud-infra/scripts/cleanup-heat-stacks.sh @@ -22,11 +22,32 @@ 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 set +u -source $WORKSPACE/.venv +source $WORKSPACE/.venv/bin/activate set -u pip install --quiet --upgrade pip pip install --quiet python-cinderclient==6.0.0