mirror of
https://github.com/netbox-community/Device-Type-Library-Import.git
synced 2024-11-25 17:13:20 +01:00
add vendors as an env var
This commit is contained in:
parent
4f1455f330
commit
315dce530b
@ -10,8 +10,9 @@ import os
|
||||
import settings
|
||||
|
||||
REPO_URL = settings.REPO_URL
|
||||
|
||||
parser = argparse.ArgumentParser(description='Import Netbox Device Types')
|
||||
parser.add_argument('--vendors', nargs='+',
|
||||
parser.add_argument('--vendors', nargs='+', default=settings.VENDORS,
|
||||
help="List of vendors to import eg. apc cisco")
|
||||
parser.add_argument('--url', '--git', default=REPO_URL,
|
||||
help="Git URL with valid Device Type YAML files")
|
||||
|
@ -6,6 +6,12 @@ REPO_URL = str(os.getenv("REPO_URL"))
|
||||
NETBOX_URL = str(os.getenv("NETBOX_URL"))
|
||||
NETBOX_TOKEN = str(os.getenv("NETBOX_TOKEN"))
|
||||
|
||||
# optionnally load vendors through a space separated list as env var
|
||||
try:
|
||||
VENDORS = os.getenv("VENDORS").split(" ")
|
||||
except AttributeError:
|
||||
VENDORS = None
|
||||
|
||||
MANDATORY_ENV_VARS = ["REPO_URL", "NETBOX_URL", "NETBOX_TOKEN"]
|
||||
|
||||
for var in MANDATORY_ENV_VARS:
|
||||
|
Loading…
Reference in New Issue
Block a user