forked from MyriamFentanes/rhpam7-complaints-management-demo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init-openshift.sh
executable file
·39 lines (33 loc) · 1.31 KB
/
init-openshift.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
#!/bin/sh
. init-properties.sh
command -v oc >/dev/null 2>&1 || {
echo >&2 "The oc client tools need to be installed to connect to OpenShift.";
echo >&2 "Download it from https://www.openshift.org/download.html and confirm that \"oc version\" runs.";
exit 1;
}
function echo_header() {
echo
echo "########################################################################"
echo $1
echo "########################################################################"
}
PRJ_DEMO="complaints-mgmnt"
PRJ_DEMO_NAME=$(./support/openshift/provision.sh info $PRJ_DEMO | awk '/Project name/{print $3}')
# Check if the project exists
oc get project $PRJ_DEMO_NAME > /dev/null 2>&1
PRJ_EXISTS=$?
if [ $PRJ_EXISTS -eq 0 ]; then
echo_header "$PRJ_DEMO_NAME project already exists. Deleting project."
./support/openshift/provision.sh delete $PRJ_DEMO
# Wait until the project has been removed
echo_header "Waiting for OpenShift to clean deleted project."
sleep 30
else if [ ! $PRJ_EXISTS -eq 1 ]; then
echo "An error occurred communicating with your OpenShift instance."
echo "Please make sure that your logged in to your OpenShift instance with your 'oc' client."
exit 1
fi
fi
echo_header "Provisioning $PRODUCT $DEMO_NAME"
./support/openshift/provision.sh setup $PRJ_DEMO --with-imagestreams
echo_header "Setup completed."