mirror of
https://github.com/netbox-community/Device-Type-Library-Import.git
synced 2025-01-23 22:08:35 +01:00
Add CLI options for git URL
help text to CLI options
This commit is contained in:
parent
1f31c11eda
commit
54907aaffb
@ -3,13 +3,12 @@ from collections import Counter
|
||||
import yaml, pynetbox, glob, argparse, os, settings
|
||||
|
||||
parser = argparse.ArgumentParser(description='Import Netbox Device Types')
|
||||
parser.add_argument('--vendor', nargs='+')
|
||||
|
||||
parser.add_argument('--vendor', nargs='+', help="List of vendors to import eg. apc cisco")
|
||||
parser.add_argument('--url','--git', default='https://github.com/netbox-community/devicetype-library.git', help="Git URL with valid Device Type YAML files")
|
||||
args = parser.parse_args()
|
||||
|
||||
cwd = os.getcwd()
|
||||
counter = Counter(added=0,updated=0,manufacturer=0)
|
||||
url = 'https://github.com/netbox-community/devicetype-library.git'
|
||||
nbUrl = settings.NETBOX_URL
|
||||
nbToken = settings.NETBOX_TOKEN
|
||||
|
||||
@ -249,10 +248,10 @@ try:
|
||||
update_package('./repo')
|
||||
print(msg)
|
||||
else:
|
||||
repo = Repo.clone_from(url, os.path.join(cwd, 'repo'))
|
||||
repo = Repo.clone_from(args.url, os.path.join(cwd, 'repo'))
|
||||
print("Package Installed")
|
||||
except exc.GitCommandError as error:
|
||||
print("Couldn't clone {} ({})".format(url, error))
|
||||
print("Couldn't clone {} ({})".format(args.url, error))
|
||||
|
||||
nb = pynetbox.api(nbUrl, token=nbToken)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user