Closed titom73 closed 5 months ago
Running the script with no arguments would cause all items to be imported, I am not sure if that is desired behavior. I also have not looked into the use case for dockerizing this, could you provide some insight how you use this with docker?
Today, current docker implementation does run an import for all vendors if nothing is specified
$ cat env-develop
NETBOX_URL=http://10.73.1.248:8000
NETBOX_TOKEN=hidden
REPO_URL=https://github.com/titom73/netbox-devicetype-library.git
REPO_BRANCH=homenetwork
IGNORE_SSL_ERRORS=False
#SLUGS=c9300-48u isr4431 isr4331
$ docker run --rm --env-file=env-develop ghcr.io/minitriga/netbox-device-type-library-import
Package Installed https://github.com/titom73/netbox-devicetype-library.git
No Vendors Specified, Gathering All Device-Types
106 Vendors Found
After adding VENDORS
key in environment, both scripts have the same behavior:
$ cat env-develop
NETBOX_URL=http://10.73.1.248:8000
NETBOX_TOKEN=hidden
REPO_URL=https://github.com/titom73/netbox-devicetype-library.git
REPO_BRANCH=homenetwork
IGNORE_SSL_ERRORS=False
VENDORS=Arista
With current docker image
$ docker run --rm --env-file=env-develop ghcr.io/minitriga/netbox-device-type-library-import
Package Installed https://github.com/titom73/netbox-devicetype-library.git
Vendor Specified, Gathering All Matching Device-Types
1 Vendors Found
52 Device-Types Found
With new Dockerfile:
$ docker run --rm --env-file=env-develop ghcr.io/titom73/nb-device-importer:dev
Package Installed https://github.com/titom73/netbox-devicetype-library.git
1 Vendors Found
52 Device-Types Found
Idea of this change is to be able to use cli options in any situation: script invocation or docker execution.
Looks like a good idea to me. So we have a bit more lifting to do, since the repo was moved from minitriga to netbox-community we need to setup the docker package and all of that good stuff. Please ping me if a few days go by and I havent reached back out about that yet
Overview
Moving script to entrypoint make it easier to leverage script argument from CLI instead of always leveraging ENV variable.
ENV
variable approach is unchanged and can still be used.Changes:
Dockerfile
forENTRYPOINT
Dockerfile
to explicitely setENV
namesREADME.md
)README.md