Merge "Revert "cloud-infra: Use sudo while operating on openrc""
authorFatih Degirmenci <fdegir@gmail.com>
Fri, 29 Nov 2019 06:52:03 +0000 (06:52 +0000)
committerNordix Gerrit <gerrit@nordix.org>
Fri, 29 Nov 2019 06:52:03 +0000 (06:52 +0000)
1  2 
jjb/cloud-infra/delete-heat-stack.sh

index 63c3beae22d04359897a682b8b96e3d9baee58b7,872ba304d9d67f82da1cc5c38959aa73debe5453..b732de44601743e61042cc4e8f5f84606356845e
@@@ -29,18 -29,17 +29,18 @@@ if [[ $DEPLOY_TYPE != "cloud" ]]; the
    exit 0
  fi
  
 -# we only support k8s scenario deployment on openstack as of now
 -if [[ "$DEPLOY_SCENARIO" != "k8-*" ]] && [[ "$PROVISIONER_TYPE" == "heat" ]]; then
 +# do not delete the stack if not explicitly set to delete
 +if [[ "$DELETE_STACK" != "yes" ]]; then
    echo "-------------------------------------------------------------------------"
 -  echo "Info: Only k8s scenario deployment on OpenStack has been implemented!"
 +  echo "Info: Stack will not be deleted upon the completion of the job!"
    echo "-------------------------------------------------------------------------"
    exit 0
  fi
  
 -if [[ "$DELETE_STACK" != "yes" ]]; then
 +# k8s and onap scenario have stacks so exit for others
 +if [[ ! "$DEPLOY_SCENARIO" =~ ^k8-.*|^onap-.* ]]; then
    echo "-------------------------------------------------------------------------"
 -  echo "Info: Stack will not be deleted upon the completion of the job!"
 +  echo "Info: Nothing to delete!"
    echo "-------------------------------------------------------------------------"
    exit 0
  fi
@@@ -62,7 -61,7 +62,7 @@@ set -
  pip install -q openstacksdk python-openstackclient python-heatclient
  echo "Info: Deleting stack $STACK_NAME"
  echo "-------------------------------------------------------------------------"
- source /tmp/openrc && sudo /bin/rm -f /tmp/openrc
+ source /tmp/openrc && /bin/rm -f /tmp/openrc
  openstack stack delete $STACK_NAME --wait --yes
  echo "-------------------------------------------------------------------------"
  echo "Info: Stack $STACK_NAME has been deleted!"