Skip to content

Commit 327b3a1

Browse files
authored
Migrate populating local demo data through database.sql to using NetBox API (#177)
1 parent 5e3f2e6 commit 327b3a1

File tree

22 files changed

+613
-244
lines changed

22 files changed

+613
-244
lines changed

kind/load-data-job/dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
FROM python:3.12
2+
ADD main.py .
3+
RUN pip install pynetbox
4+
CMD ["python", "./main.py"]

kind/load-data-job/load-data.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ TMP_SQL_FILE=$(mktemp /tmp/netbox-data-dump.XXXXXXX.sql) || exit 1
44
curl -k https://raw.githubusercontent.com/netbox-community/netbox-demo-data/master/sql/netbox-demo-v4.1.sql > "${TMP_SQL_FILE}"
55
psql "user=netbox host=netbox-db.${NAMESPACE}.svc.cluster.local" netbox -q -f "${TMP_SQL_FILE}"
66
rm "${TMP_SQL_FILE}"
7-
psql "user=netbox host=netbox-db.${NAMESPACE}.svc.cluster.local" netbox -q -f /load-data-job/local-demo-data.sql
7+
psql "user=netbox host=netbox-db.${NAMESPACE}.svc.cluster.local" netbox -q -f /load-data-job/local-data-setup.sql
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- insert User Token
2+
INSERT INTO public.users_token (id, created, expires, key, write_enabled, description, user_id, allowed_ips, last_used)
3+
VALUES (1, '2024-06-14 12:20:13.317942+00', NULL, '0123456789abcdef0123456789abcdef01234567', true, 'test-token', 1, '{}', NULL);

kind/load-data-job/local-demo-data.sql

Lines changed: 0 additions & 117 deletions
This file was deleted.

0 commit comments

Comments
 (0)