pkgctl crash during data read from server
eithor opened this issue · comments
Versions: pkgctl -v gives jctl 1.1.21 and python_jamf 0.9.0. macOS 14.2.1, Python 3.9.6 from macOS. Jamf Pro cloud server on 11.1.3
Traceback:
% ./pkgctl
Reading Jamf data (this could take several minutes, depending on the size of your data)
Warning Extra admins enabled specifies non-existant package: macautopkg
Traceback (most recent call last):
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 448, in
main(sys.argv[1:])
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 441, in main
interactive(all_packages)
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 377, in interactive
loadRelatedData(all_packages)
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 106, in loadRelatedData
record.related
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1412, in related
self.refresh_related()
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1406, in refresh_related
self.refresh_groups(related)
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1379, in refresh_groups
criterions = jamf_record.get_path("criteria/criterion/value")
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 280, in get_path
result = self.get_path_worker(path.rstrip("/").split("/"), self.data)
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 253, in get_path_worker
raise JamfRecordInvalidPath
python_jamf.exceptions.JamfRecordInvalidPath
I've updated python_jamf so that it prints the bad part of the path when it raises a JamfRecordInvalidPath. If you can reinstall jctl or update python_jamf to get the new version and try this again, it will probably print more information that will help me fix the bug.
Updated to python-jamf 0.9.3 (and Jamf Pro cloud was also updated - to 11.2.0) and traceback is now:
% ./pkgctl
Reading Jamf data (this could take several minutes, depending on the size of your data)
Traceback (most recent call last):
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 448, in
main(sys.argv[1:])
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 441, in main
interactive(all_packages)
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 377, in interactive
loadRelatedData(all_packages)
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 106, in loadRelatedData
record.related
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1414, in related
self.refresh_related()
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1408, in refresh_related
self.refresh_groups(related)
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1380, in refresh_groups
criterions = jamf_record.get_path("criteria/criterion")
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 280, in get_path
result = self.get_path_worker(path.rstrip("/").split("/"), self.data)
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 253, in get_path_worker
raise JamfRecordInvalidPath(f"Path not found {path} ({path_part} missing)")
python_jamf.exceptions.JamfRecordInvalidPath: Path not found [criteria, criterion] (criteria missing)
P.S.: The conf-python-jamf tool is still having a reference to the "jamf" instead of "python_jamf" import.
I think I figured this out. I think the error is happening because you have some group criteria that was crashing the script. So I'm just going to ignore those criteria. I just released a new version with the fix. Do you want to test it?
Updated to python_jamf 0.9.4 and it runs for longer but still fails unfortunately. Traceback is now:
% ./pkgctl
Reading Jamf data (this could take several minutes, depending on the size of your data)
Traceback (most recent call last):
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 448, in
main(sys.argv[1:])
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 441, in main
interactive(all_packages)
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 377, in interactive
loadRelatedData(all_packages)
File "/Users/macautopkg/Library/Python/3.9/bin/./pkgctl", line 106, in loadRelatedData
record.related
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1416, in related
self.refresh_related()
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1410, in refresh_related
self.refresh_groups(related)
File "/Users/macautopkg/Library/Python/3.9/lib/python/site-packages/python_jamf/records.py", line 1385, in refresh_groups
for criteria in criterions:
TypeError: NoneType object is not iterable
I just released python_jamf 0.9.5 with the fix.
Thank you for digging into this! Now with version 0.9.5 it works!