-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean.sh
More file actions
executable file
·57 lines (48 loc) · 1.17 KB
/
clean.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.17 KB
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
#!/bin/bash
#################
#
# Show help and exit
#
#################
function show_help {
echo "Usage: $0 -h"
echo "-d - delete the project"
echo "-h - ip|hostname of Openshift host"
exit 1
}
if [ ! -f config.sh ]; then
echo "No config file found .. exiting"
exit 1
fi
#
# Source the configuration
#
. ./config.sh
#
# Determine the command line options
#
while getopts "h:" opt;
do
case $opt in
d) KILL_PROJECT=1 ;;
h) OS_HOST=$OPTARG ;;
*) show_help ;;
esac
done
if [ -z "$OS_HOST" ]; then
echo "No Openshift host specified. Use -h <host|ip>"
exit 1
fi
echo -e '\n\n=== Logging into oc tool as user ==='
oc login https://$OS_HOST:8443 -u ${OPENSHIFT_USER} -p ${OPENSHIFT_USER_PASSWD}
oc whoami 2>&1 > /dev/null || { echo "Cannot log in ... exiting" && exit 1; }
# Delete application resources
oc delete all -l app=${OPENSHIFT_APPLICATION_NAME} || { echo "WARNING: Could not delete old application resources" ; }
# Delete the project
if [ -n "${KILL_PROJECT}" ]; then
oc delete project ${OPENSHIFT_PROJECT}
else
echo "== Skipping project deletion =="
fi
oc whoami || echo `oc whoami` "still logged in; use 'oc logout' to logout of openshift"
echo "Done"