forked from canpb/DO280
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlab-execute-troubleshoot
executable file
·92 lines (70 loc) · 1.95 KB
/
lab-execute-troubleshoot
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
#
# Copyright 2018 Red Hat, Inc.
#
# NAME
# lab-execute-troubleshoot - lab script for DO280-OCP4
# executing-troubleshoot lab
#
# SYNOPSIS
# lab-execute-review {start|finish}
#
# start - prepare the system for starting the lab
# finish - perform post-lab finish
#
# DESCRIPTION
# This script, based on singular argument, either does start or finish for
# the [name of the exercise]
#
# CHANGELOG
# * Wed Sep 20 2019 Fernando Lozano <flozano@redhat.com>
# - Changes for OCP4.2 and dedicated AWS cluster
# * Wed Apr 30 2019 Adrian Andrade <aandrade@redhat.com
# - original code
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/root/bin:/usr/local/bin
declare -a valid_commands=(start finish)
# Change these variables to match your exercise
this='execute-troubleshoot'
title='Guided Exercise: Executing Troubleshooting Commands'
# Do not change these variables
target='workstation'
run_as_root='true'
function lab_start {
ocp4_print_prereq_header
print_line " Preparing the student's workstation:"
ocp4_install_oc
ocp4_grab_lab_files 'no-solution'
ocp4_is_cluster_up
ocp4_fail_if_project_exists "${this}"
ocp4_exit_on_failure
ocp4_print_setup_header
ocp4_delete_all_idp
print_line " Preparing the exercise:"
pad2 "Create project '${this}'"
if oc new-project "${this}"
then
print_SUCCESS
else
print_FAIL
fi
pad2 "Deploy PostgreSQL in '${this}'"
if oc create -f "${labs}/execute-troubleshoot/psql.yaml" -n "${this}"
then
print_SUCCESS
else
print_FAIL
fi
ocp4_print_setup_footer
}
function lab_finish {
ocp4_print_cleanup_header
ocp4_login_as_admin
ocp4_delete_project "${this}"
ocp4_cleanup_lab_files 'no-solution'
ocp4_print_cleanup_footer
}
############### Don't EVER change anything below this line ###############
# Source library of functions
source /usr/local/lib/${function_lib}
source /usr/local/lib/${platform_lib}
grading_main_program "$@"