2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2019 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> openstack-stack-delete.sh"
15 # shellcheck disable=SC1090
18 # Check if openstack venv was previously created
19 if [ -f "/tmp/.os_lf_venv" ]; then
20 os_lf_venv=$(cat "/tmp/.os_lf_venv")
23 if [ -d "${os_lf_venv}" ] && [ -f "${os_lf_venv}/bin/openstack" ]; then
24 echo "Re-use existing venv: ${os_lf_venv}"
25 PATH=$os_lf_venv/bin:$PATH
27 lf-activate-venv --python python3 lftools[openstack] \
29 python-openstackclient
32 echo "INFO: Retrieving stack cost for: $OS_STACK_NAME"
33 if ! lftools openstack --os-cloud "$OS_CLOUD" stack cost "$OS_STACK_NAME" > stack-cost; then
34 echo "WARNING: Unable to get stack costs, continuing anyway"
35 echo "total: 0" > stack-cost
37 echo "DEBUG: Successfully retrieved stack cost: $(cat stack-cost)"
40 # Delete the stack even if the stack-cost script fails
41 lftools openstack --os-cloud "$OS_CLOUD" stack delete "$OS_STACK_NAME" \