-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathcheck-product-csv.sh
More file actions
executable file
·33 lines (26 loc) · 1014 Bytes
/
check-product-csv.sh
File metadata and controls
executable file
·33 lines (26 loc) · 1014 Bytes
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
#!/usr/bin/env bash
set -eu
while IFS=, read -r product definition location; do
if [[ $definition == *"http"* ]]; then
datacube product add $definition
fi
done < /env/config/${ENV}-products.csv
# if [ $(datacube product list | wc -l) -ne 69 ]; then
# exit 1
# fi
datacube product list
wget https://${EXPLORER_ENDPOINT}/audit/storage.csv -O /tmp/live-db-products.csv
# check if workspace csv has all the products in live db
while IFS=, read -r name count location license definition summary metadata_type; do
if ! grep -q $name /env/config/${ENV}-products.csv; then
if [ "$name" != "name" ]; then
echo missing $name from live ${ENV} database
fi
fi
done < /tmp/live-db-products.csv
# check if workspace csv has extra products NOT in live db
while IFS=, read -r product definition location; do
if ! grep -q $product /tmp/live-db-products.csv; then
echo csv has $product but not in live ${ENV} db
fi
done < /env/config/${ENV}-products.csv