-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathopenstack-project-delete.sh
executable file
·78 lines (63 loc) · 1.12 KB
/
openstack-project-delete.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh
#!set -x
#!read trap debug
if [ $# -eq 0 ]
then
echo " Usage: `basename $0` Project#"
exit 2
fi
#variables
id=$1
tenant=Tenant
project=Project
user=user
ks_dir=/root/keystonerc
network_router(){
#neutron floatingip-delete <floatingip-id>
ns=`neutron router-list| grep $id | awk '{print $2}'`
ns=qrouter-$ns
neutron router-gateway-clear router$id
neutron router-interface-delete router$id PrivateSubnet_$id
neutron router-delete router$id
ip netns delete $ns
}
network_net(){
neutron net-delete PrivateNet_$id
}
network_subnet(){
neutron subnet-delete PrivateSubnet_$id
}
user(){
keystone user-delete $user$id
}
tenant(){
keystone tenant-delete $project$id
}
role(){
keystone role-delete admin$id
}
secgroup(){
nova secgroup-delete SecGrp$id
}
keystonerc(){
echo " INFO: Deleting $ks_dir/keystonerc_$user$id"
rm -rf $ks_dir/keystonerc_$user$id
}
pem_file(){
echo " INFO: Deleting $ks_dir/$user$id.pem "
rm -rf $ks_dir/key$id.pem
}
keypair(){
echo " INFO: Deleting keypair key$id"
nova keypair-delete key$id
}
network_router
network_net
network_subnet
secgroup
keypair
user
role
tenant
keystonerc
pem_file