-
Notifications
You must be signed in to change notification settings - Fork 5
/
load-records
executable file
·36 lines (28 loc) · 1.13 KB
/
load-records
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
#!/usr/bin/env bash
ORIG_DIR="$(pwd)"
cd "$(dirname "$0")"
BIN_DIR="$(pwd)"
cd "${ORIG_DIR}"
onExit() {
cd "${ORIG_DIR}"
}
trap onExit EXIT
metadata_source="${1}"
if [ -z "${metadata_source}" ]; then
echo "ERROR: must supply metadata source (file or directory)"
exit 1
fi
# Deduce name of the pycsw pod
pod_name="$(kubectl -n rm get pod --selector='io.kompose.service=pycsw' --output=jsonpath={.items[0].metadata.name})"
echo "Using pycsw pod: ${pod_name}"
# Load
kubectl -n rm exec -i "${pod_name}" -- rm -rf /tmp/metadata
kubectl -n rm cp "${metadata_source}" "${pod_name}":/tmp/metadata
kubectl -n rm exec -i "${pod_name}" -- pycsw-admin.py load-records -c /etc/pycsw/pycsw.cfg -y -r -p /tmp/metadata
# kubectl -n rm exec -i "${pod_name}" -- ls -lR /tmp/metadata
# Delete
# kubectl -n rm exec -i "${pod_name}" -- pycsw-admin.py delete-records -c /etc/pycsw/pycsw.cfg
# Export
# kubectl -n rm exec -i "${pod_name}" -- rm -rf /tmp/metadata-export
# kubectl -n rm exec -i "${pod_name}" -- mkdir -p /tmp/metadata-export
# kubectl -n rm exec -i "${pod_name}" -- pycsw-admin.py export-records -c /etc/pycsw/pycsw.cfg -p /tmp/metadata-export