You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This changes the `--dryrun` flag so that it runs all code, but doesn't update anything in jamf or snipeit.
It also introduces a `--connection_test` flag, which takes over the functionality of the old dryrun flag.
The main idea behind this is, that for debugging and development purposes it might be useful to run almost all code,
but stop short of updating the environment.
Copy file name to clipboardExpand all lines: jamf2snipe
+26-4
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,8 @@ import datetime
60
60
runtimeargs=argparse.ArgumentParser()
61
61
runtimeargs.add_argument("-v", "--verbose", help="Sets the logging level to INFO and gives you a better idea of what the script is doing.", action="store_true")
62
62
runtimeargs.add_argument("--auto_incrementing", help="You can use this if you have auto-incrementing enabled in your snipe instance to utilize that instead of adding the Jamf ID for the asset tag.", action="store_true")
63
-
runtimeargs.add_argument("--dryrun", help="This checks your config and tries to contact both the JAMFPro and Snipe-it instances, but exits before updating or syncing any assets.", action="store_true")
63
+
runtimeargs.add_argument("--dryrun", help="This checks your config and tries to contact both the JAMFPro and Snipe-it instances, and will generate the assets for debugging, but not update or sync anything but exits before updating or syncing any assets.", action="store_true")
64
+
runtimeargs.add_argument("--connection_test", help="This checks your config and tries to contact both the JAMFPro and Snipe-it instances.", action="store_true")
64
65
runtimeargs.add_argument("-d", "--debug", help="Sets logging to include additional DEBUG messages.", action="store_true")
65
66
runtimeargs.add_argument("--do_not_update_jamf", help="Does not update Jamf with the asset tags stored in Snipe.", action="store_false")
66
67
runtimeargs.add_argument('--do_not_verify_ssl', help="Skips SSL verification for all requests. Helpful when you use self-signed certificate.", action="store_false")
@@ -89,8 +90,20 @@ elif user_args.debug:
89
90
else:
90
91
logging.basicConfig(level=logging.WARNING)
91
92
93
+
# Notify users if we're doing a connection test.
94
+
ifuser_args.connection_testanduser_args.dryrun:
95
+
logging.error("You can't use --connection_test and --dryrun at the same time. Please choose one or the other.")
logging.debug('Making Get request against: {}\nPayload for the PUT request is: {}\nThe username, password, and headers can be found near the beginning of the output.'.format(api_url, payload))
logging.debug('Making Get request against: {}\nPayload for the PUT request is: {}\nThe username, password, and headers can be found near the beginning of the output.'.format(api_url, payload))
0 commit comments