1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#6529 - Adjusted the arguments. Fixed documentation

This commit is contained in:
Daniel Sheppard
2021-11-02 21:37:11 -05:00
parent 7c3318df92
commit 19bacc9e23
2 changed files with 12 additions and 5 deletions

View File

@ -28,10 +28,10 @@ class Command(BaseCommand):
dest='loglevel',
default='info',
choices=['debug', 'info', 'warning', 'error', 'critical'])
parser.add_argument('--script', help="Script to run", required=True)
parser.add_argument('--commit', help="Commit this script to database", action='store_true')
parser.add_argument('--user', help="User script is running as")
parser.add_argument('data', help="Data as a string encapsulated JSON blob")
parser.add_argument('--data', help="Data as a string encapsulated JSON blob")
parser.add_argument('script', help="Script to run")
def handle(self, *args, **options):
def _run_script():
@ -69,7 +69,12 @@ class Command(BaseCommand):
script = options['script']
loglevel = options['loglevel']
commit = options['commit']
data = json.loads(options['data']) if options['data'] is not None else None
try:
data = json.loads(options['data'])
except TypeError:
data = {}
module, name = script.split('.', 1)