grokability / jamf2snipe

Import and sync assets from a JAMFPro instance to Snipe-IT asset management.
MIT License
108 stars 55 forks source link

Dry Run Debug Issue #21

Closed su-overlord closed 4 years ago

su-overlord commented 4 years ago

Hi,

We have setup the script on a raspberry Pi 4

When I do a dry run I get this:

root@raspberrypi8:~# jamf2snipe --dryrun -d --do_not_verify_ssl /opt/jamf2snipe/jamf2snipe:298: SyntaxWarning: "is" with a literal. Did you mean "=="? SNIPE_UP = True if requests.get(snipe_base, verify=args.do_not_verify_ssl).status_code is 200 else False /opt/jamf2snipe/jamf2snipe:331: SyntaxWarning: "is" with a literal. Did you mean "=="? if model['model_number'] is "": /opt/jamf2snipe/jamf2snipe:375: SyntaxWarning: "is" with a literal. Did you mean "=="? if snipe is 'NoMatch': /opt/jamf2snipe/jamf2snipe:378: SyntaxWarning: "is" with a literal. Did you mean "=="? if jamf['general']['asset_tag'] is '': /opt/jamf2snipe/jamf2snipe:391: SyntaxWarning: "is" with a literal. Did you mean "=="? elif snipe is 'MultiMatch': /opt/jamf2snipe/jamf2snipe:393: SyntaxWarning: "is" with a literal. Did you mean "=="? elif snipe is 'ERROR' Dryrun: Starting jamf2snipe with a dry run where no assets will be updated. INFO:root:Searching for a valid settings.conf file. DEBUG:root:Checking for a settings.conf in /opt/jamf2snipe ... INFO:root:Great, we found a settings file. Let's get started by parsing all fo the settings. INFO:root:The configured JAMFPro base url is: https://currencycloud.jamfcloud.com/ INFO:root:The configured JAMFPro username we'll be connecting with is: snipeit.automation Traceback (most recent call last): File "/opt/jamf2snipe/jamf2snipe", line 100, in jamf_api_password = config['jamf']['password'] File "/usr/local/lib/python3.8/configparser.py", line 1255, in getitem return self._parser.get(self._name, key) File "/usr/local/lib/python3.8/configparser.py", line 799, in get return self._interpolation.before_get(self, section, option, value, File "/usr/local/lib/python3.8/configparser.py", line 395, in before_get self._interpolate_some(parser, option, L, value, section, defaults, 1) File "/usr/local/lib/python3.8/configparser.py", line 442, in _interpolate_some raise InterpolationSyntaxError( configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: 'Password goes here it is removed for security reasons'

christovic commented 4 years ago

The warnings are Python 3.8 specific, doesn't happen on 3.7.

The reason you get the traceback is because you have a percent sign in your password. The script doesn't seem to be set up to handle this case.

Shouldn't be a problem to add an interpolation exception for the password fields...

If you want to get it working right away, try changing the jamf password to something with just numbers and letters.

Edit: it should be possible to just double the percent sign in the settings.conf file. For example if your password was p%ssword, you'd change it to p%%sword