diff --git a/kind/load-data-job/load-data.orig.sh b/kind/load-data-job/load-data.orig.sh new file mode 100755 index 0000000..a8cfe3b --- /dev/null +++ b/kind/load-data-job/load-data.orig.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -o errexit + +TMP_SQL_FILE=$(mktemp /tmp/netbox-data-dump.XXXXXXX.sql) || exit 1 +curl -k https://raw.githubusercontent.com/netbox-community/netbox-demo-data/master/sql/netbox-demo-v4.1.sql > "${TMP_SQL_FILE}" +psql "user=netbox host=netbox-db.${NAMESPACE}.svc.cluster.local" netbox -q -f "${TMP_SQL_FILE}" +rm "${TMP_SQL_FILE}" +psql "user=netbox host=netbox-db.${NAMESPACE}.svc.cluster.local" netbox -q -f /load-data-job/local-data-setup.sql diff --git a/kind/local-env.sh b/kind/local-env.sh index eb00ad4..532de87 100755 --- a/kind/local-env.sh +++ b/kind/local-env.sh @@ -66,8 +66,8 @@ if [[ "${VERSION}" == "3.7.8" ]] ;then # # perform patching, as we need different demo data and adapt to the database schema # # to avoid accidental check-in of the files, the base file is renamed to xx.orig.yy, and the xx.yy is added to .gitignore - # # patch load-data.sh - # sed 's/netbox-demo-v4.1.sql/netbox-demo-v3.7.sql/g' $(dirname "$0")/load-data-job/load-data.orig.sh > $(dirname "$0")/load-data-job/load-data.sh && chmod +x $(dirname "$0")/load-data-job/load-data.sh + # patch load-data.sh + sed 's/netbox-demo-v4.1.sql/netbox-demo-v3.7.sql/g' $(dirname "$0")/load-data-job/load-data.orig.sh > $(dirname "$0")/load-data-job/load-data.sh && chmod +x $(dirname "$0")/load-data-job/load-data.sh # # patch local-demo-data.sql # sed \ @@ -88,8 +88,8 @@ elif [[ "${VERSION}" == "4.0.11" ]] ;then ) NETBOX_HELM_CHART="https://github.com/netbox-community/netbox-chart/releases/download/netbox-5.0.0-beta.84/netbox-5.0.0-beta.84.tgz" - # # patch load-data.sh - # sed 's/netbox-demo-v4.1.sql/netbox-demo-v4.0.sql/g' $(dirname "$0")/load-data-job/load-data.orig.sh > $(dirname "$0")/load-data-job/load-data.sh && chmod +x $(dirname "$0")/load-data-job/load-data.sh + # patch load-data.sh + sed 's/netbox-demo-v4.1.sql/netbox-demo-v4.0.sql/g' $(dirname "$0")/load-data-job/load-data.orig.sh > $(dirname "$0")/load-data-job/load-data.sh && chmod +x $(dirname "$0")/load-data-job/load-data.sh # # patch local-demo-data.sql # sed \ @@ -107,7 +107,7 @@ elif [[ "${VERSION}" == "4.1.8" ]] ;then "ghcr.io/zalando/spilo-16:3.2-p3" \ ) - # cp $(dirname "$0")/load-data-job/load-data.orig.sh $(dirname "$0")/load-data-job/load-data.sh + cp $(dirname "$0")/load-data-job/load-data.orig.sh $(dirname "$0")/load-data-job/load-data.sh # cp $(dirname "$0")/load-data-job/local-demo-data.orig.sql $(dirname "$0")/load-data-job/local-demo-data.sql else echo "Unknown version ${VERSION}"