univ-of-utah-marriott-library-apple / jctl

`jctl` uses `python-jamf` to select objects to create, delete, print and update. It allows performing Jamf Pro repetitive tasks quickly and provides options not available in the web GUI. It is similar to SQL statements, but far less complex.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"jctl computers -d -s general/last_contact_time~=2021" leads to ValueError

venkman-gh opened this issue · comments

I'm trying to delete computers that did not contacted our Jamf Pro instance since 2020 and 2021. I'm running jctl 1.1.15 with python_jamf 0.7.4. In my case I could run the following line successfully;

jctl computers -d -s general/last_contact_time~=2021

But the following line exited with a ValueError:

jctl computers -d -s general/last_contact_time~=2020

Here's the stack trace;

Traceback (most recent call last): File "/usr/local/bin/jctl", line 559, in <module> main(sys.argv[1:]) File "/usr/local/bin/jctl", line 389, in main path_data = record.get_path(m[1]) File "/Library/Python/3.8/site-packages/jamf/records.py", line 508, in get_path self.refresh() File "/Library/Python/3.8/site-packages/jamf/records.py", line 449, in refresh results = self.api.get(end) File "/Library/Python/3.8/site-packages/jamf/api.py", line 193, in get self.set_session_auth() File "/Library/Python/3.8/site-packages/jamf/api.py", line 154, in set_session_auth deadline = datetime.strptime(expires.split('.')[0], '%Y-%m-%dT%H:%M:%S') File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/_strptime.py", line 352, in _strptime raise ValueError("unconverted data remains: %s" % ValueError: unconverted data remains: Z

Hi @venkman-gh

Thanks for the issue report. We will investigate and report back on the status as soon as we have the bandwidth and are able.

For the record, I also get this sometimes in JamfUploader when checking the token expiry. I haven't fully gotten to the bottom of it yet, but it's to do with the Z at the end of the date/time format of the token. Running the query again almost always solves it.

FWIW, I've also ran 'conf-python-jamf -t' in a virtual environment with python 3.9.9 (on the same Mac), resulting in the same error;

(imac_venv) my_username@My_iMac ~ % /Users/my_username/imac_venv/bin/conf-python-jamf -t Traceback (most recent call last): File "/Users/my_username/imac_venv/bin/conf-python-jamf", line 8, in <module> sys.exit(main()) File "/Users/my_username/imac_venv/lib/python3.9/site-packages/jamf/setconfig.py", line 119, in main setconfig(sys.argv[1:]) File "/Users/my_username/imac_venv/lib/python3.9/site-packages/jamf/setconfig.py", line 88, in setconfig pprint.pprint(api.get("accounts")) File "/Users/my_username/imac_venv/lib/python3.9/site-packages/jamf/api.py", line 193, in get self.set_session_auth() File "/Users/my_username/imac_venv/lib/python3.9/site-packages/jamf/api.py", line 154, in set_session_auth deadline = datetime.strptime(expires.split('.')[0], '%Y-%m-%dT%H:%M:%S') File "/usr/local/my_org/python/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "/usr/local/my_org/python/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 352, in _strptime raise ValueError("unconverted data remains: %s" % ValueError: unconverted data remains: Z

Sorry for taking so long to get to this. We've actually fixed this. I thought we put this in the latest release but we haven't released a new version since we fixed it. I'll work on getting it updated.

I've released the fix. The bug was in python-jamf, so that's what was updated.