Skip to content

Commit

Permalink
Migrate populating local demo data through database.sql to using NetB…
Browse files Browse the repository at this point in the history
…ox API (#177)
  • Loading branch information
henrybear327 authored Dec 18, 2024
1 parent 5e3f2e6 commit 327b3a1
Show file tree
Hide file tree
Showing 22 changed files with 613 additions and 244 deletions.
4 changes: 4 additions & 0 deletions kind/load-data-job/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM python:3.12
ADD main.py .
RUN pip install pynetbox
CMD ["python", "./main.py"]
2 changes: 1 addition & 1 deletion kind/load-data-job/load-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ 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-demo-data.sql
psql "user=netbox host=netbox-db.${NAMESPACE}.svc.cluster.local" netbox -q -f /load-data-job/local-data-setup.sql
3 changes: 3 additions & 0 deletions kind/load-data-job/local-data-setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- insert User Token
INSERT INTO public.users_token (id, created, expires, key, write_enabled, description, user_id, allowed_ips, last_used)
VALUES (1, '2024-06-14 12:20:13.317942+00', NULL, '0123456789abcdef0123456789abcdef01234567', true, 'test-token', 1, '{}', NULL);
117 changes: 0 additions & 117 deletions kind/load-data-job/local-demo-data.sql

This file was deleted.

Loading

0 comments on commit 327b3a1

Please sign in to comment.