qinling/tools/clear_resources.sh
Lingxian Kong a2213f3f6d Fix relationship of function service mapping
When deleting function, the service mapping record should be
deleted automatically.

Provide a helper script for resource clean up.

Change-Id: Ie3db454b5bcfb74a0826f01c4626fb45fca58478
2017-07-27 23:14:27 +12:00

35 lines
728 B
Bash

#!/usr/bin/env
set -e
function delete_resources(){
# Delete jobs
ids=$(openstack job list -f yaml -c Id | awk '{print $3}')
for id in $ids
do
openstack job delete $id
done
# Delete executions
ids=$(openstack function execution list -f yaml -c Id | awk '{print $3}')
for id in $ids
do
openstack function execution delete $id
done
# Delete functions
ids=$(openstack function list -f yaml -c Id | awk '{print $3}')
for id in $ids
do
openstack function delete $id
done
# Delete runtimes
ids=$(openstack runtime list -f yaml -c Id | awk '{print $3}')
for id in $ids
do
openstack runtime delete $id
done
}
delete_resources