X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fopenstack-stack-delete.sh;fp=shell%2Fopenstack-stack-delete.sh;h=6124c7e21a8d3cd90af476667bc25564a86198f8;hb=3937b8cb2c1b6ba0997d5aeba1b38085e57a7d2f;hp=0000000000000000000000000000000000000000;hpb=e0d89dd8e2e6ab0a31b300ef64589cb513e1550c;p=releng%2Fglobal-jjb.git diff --git a/shell/openstack-stack-delete.sh b/shell/openstack-stack-delete.sh new file mode 100644 index 00000000..6124c7e2 --- /dev/null +++ b/shell/openstack-stack-delete.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# SPDX-License-Identifier: EPL-1.0 +############################################################################## +# Copyright (c) 2019 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## +echo "---> openstack-stack-delete.sh" + +set -eufo pipefail + +# shellcheck disable=SC1090 +source ~/lf-env.sh + +lf-activate-venv lftools[openstack] python-openstackclient + +echo "INFO: Retrieving stack cost for: $OS_STACK_NAME" +if ! lftools openstack --os-cloud $OS_CLOUD stack cost $OS_STACK_NAME > stack-cost; then + echo "WARNING: Unable to get stack costs, continuing anyway" + echo "total: 0" > stack-cost +else + echo "DEBUG: Successfully retrieved stack cost: $(cat stack-cost)" +fi + +# Delete the stack even if the stack-cost script fails +lftools openstack --os-cloud "$OS_CLOUD" stack delete "$OS_STACK_NAME" \ + | echo "INFO: $(cat)" +