-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path038-admin-proxy-import.sh
More file actions
executable file
·37 lines (30 loc) · 1.32 KB
/
038-admin-proxy-import.sh
File metadata and controls
executable file
·37 lines (30 loc) · 1.32 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
#!/bin/bash
# Resource: Proxy Configuration(Under Administration)
# this is the second script.
# The second script will create proxy resources on SM based on the template files.
# run 038-proxy-create-template.sh first and manually fill in the missing field values before run this script.
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
DATA_DIR="$SCRIPT_DIR"/data/proxy
TEMPLATE_DIR=template
if [ ! -d $DATA_DIR ]; then
echo "Nothing to do without directory $DATA_DIR, please backup data first"
exit 0
fi
echo "************************************************************************"
echo "* Importing Proxy into TMC SM ..."
echo "************************************************************************"
if [ ! -d $DATA_DIR/$TEMPLATE_DIR ]; then
echo "Nothing to do without directory $DATA_DIR/$TEMPLATE_DIR, please generate template files with script 038-admin-proxy-create-template.sh"
echo "Please fill in the missing values in each template file(proxy/template/*.yaml) manually."
exit 0
fi
for file in "$DATA_DIR"/$TEMPLATE_DIR/*; do
if [ -f "$file" ]; then
echo "Create credential with file $file"
tanzu tmc account credential create --file $file
if [ $? -eq 0 ]; then
echo "Successfully created the credential with file $file"
fi
fi
done
echo "Imported Proxy into TMC SM ..."