netbox-community / Device-Type-Library-Import

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library
https://github.com/netbox-community/devicetype-library
MIT License
247 stars 74 forks source link

Device Type Library Importer behind a proxy #126

Closed Dominik9798 closed 3 months ago

Dominik9798 commented 3 months ago

Hello,

I have netbox 2.8.0 running and it works in my local network in a Debian VM. For security reasons this VM is behind a Squid proxy to which I have no administrative access. Name resolution works via another DNS server. How do I get the script Device Type Library Importer to call a proxy? The command: docker run -e "NETBOX_URL=http://192.xxx.xxx.xxx:8000/" -e "NETBOX_TOKEN=xxx" --env HTTP_PROXY="http://192.xxx.xxx.xxx:8080" ghcr.io/minitriga/netbox-device-type-library-import does not work and ends in the following error: Traceback (most recent call last): File "/app/nb-dt-import.py", line 853, in <module> main() File "/app/nb-dt-import.py", line 776, in main determine_features(nb) File "/app/nb-dt-import.py", line 39, in determine_features nb_ver = [int(x) for x in nb.version.split('.')] File "/usr/local/lib/python3.9/site-packages/pynetbox/api.py", line 212, in version version = Request( File "/usr/local/lib/python3.9/site-packages/pynetbox/core/query.py", line 189, in get_version raise RequestError(req) pynetbox.core.query.RequestError: The request failed with code 403 Forbidden but more specific details were not returned in json. Check the NetBox Logs or investigate this exception's error attribute.

Without --env HTTP_PROXY="http://192.xxx.xxx.xxx:8080" I have the following error: `Couldn't clone https://github.com/netbox-community/devicetype-library.git (Cmd('git') failed due to: exit code(128) cmdline: git clone --branch=master -v https://github.com/netbox-community/devicetype-library.git /app/repo stderr: 'Cloning into '/app/repo'... fatal: unable to access 'https://github.com/netbox-community/devicetype-library.git/': Failed to connect to github.com port 443 after 2058 ms: Host is unreachable ') No Vendors Specified, Gathering All Device-Types 0 Vendors Found 0 Device-Types Found No Vendors Specified, Gathering All Module-Types 0 Module Vendors Found 0 Module-Types Found

Script took 0:00:02.170785 to run 0 devices created 0 interfaces/ports updated 0 manufacturers created 0 modules created 0 module interface / ports created`

Has someone any idea?

Dominik9798 commented 3 months ago

It works with --env **HTTPS_PROXY**="http://192.xxx.xxx.xxx:8080"