Open Cr4sh0ver1de opened 1 month ago
This is the log from Jamf for the fails
Script result: 2024-07-03 15:51:09 - PRE-FLIGHT CHECK: swiftDialog version 2.5.0.4768 found; proceeding... 2024-07-03 15:56:27 - API Credentials work, invalidating token 2024-07-03 15:56:27 - Token already invalid 2024-07-03 15:56:27 - Workflow Selected: Static / Smart Group. Password Option: Set your own. 2024-07-03 15:56:40 - Found old csv, deleting now 2024-07-03 15:56:40 - Found old python script, deleting now 2024-07-03 15:56:41 - number of computers returned: 452 -:1: parser error : StartTag: invalid element name <!doctype html>
HTTP Status 404 – Not Found</title ^ -:1: parser error : Extra content at the end of the document <!doctype html> HTTP Status 404 – Not Found</title ^ 0 serials found in smart group 2024-07-03 16:00:10 - No Matching Serial Numbers Found. Attempted to search 0 serial numbers.
Well, huh, that is a new one. The number you should be using the first one you tried: 153. But getting that 404 is really interesting. When I tested this with a non-existent group in my environment I was able to get a parser error, but not the 404.
I also have a much smaller environment so my results might be just luck. One quick troubleshooting step is we can just programmatically set the group to 153 regardless and see if the error persists -- this way we can see if it is an issue with how the variable is being set or how the variable is being used.
As a temporary workaround, can you replace line 288 with this? (You will still get prompted to put in a smart group, this will just set to whatever you put there as 153)
smartgroupselection=153
If this doesn't work, we can go to line 402 and replace $smartgroupselection to 153.
I am going to work on putting in some better logging when selecting a smart group and create a branch with that work. Apologies that this isn't working appropriately.
Hey Chris. Thanks for the comment. Sorry for the delay in my reply.
Can you confirm that 288 is the correct line? This is what i am seeing for that line in the latest version
Also seeing this for 402
Maybe thinking this should be line 393?
Looking at the screenshots. . . yes, you're right (I am working on commenting and my lines were off on the script I am using.)! Let's replace the smartgroupselection variable to be just your group number of 153. If things work as expected, then I know it has something to do with the reading of the file to get the smart / static group.
If it doesn't work, then we will want to just replace the variable in our curl command $smartgroupselection to just be 153 -- no variables at all. If that works, then it has to do with how the variable is being passed in the script.
Finally, it might be worth just testing this group in the Jamf Pro API (instance.jamfcloud.com/api) > Classic API > computergroups > and test out the GET function as it might be an odd db issue in the Jamf Pro server.
If all of that doesn't work. . . we might just create a new smart group and test out there.
Hey @chrisgzim sorry for the delay in my reply. I've been away.
So I updated the script to use the group ID as mentioned, but still got the same result
I then popped to the classic API and made sure that that was able to see the groupID of 153, which it could... however, i did notice that like the message mentions, there are no Management IDs in the output.
Hey @Cr4sh0ver1de no worries. The error that we're getting should be adjusted because you're getting the management ids from an earlier API call. (Which we can see with the "Number of Computers Returned: 452" What is actually happening is that we can't find any serial numbers being returned in the smart group -- for whatever reason the smart group call is failing and throwing off the rest of the workflow. (I am going to create some better logic for this so there error is more clear.)
Glad to see that it is working in the GUI of the Classic API! But now I gotta see what in my logic would be causing a 404 when doing what should be a similar API call. . .
Okay, I just committed something to development to get us some better logging on what is potentially going on. If we're still stuck, I would want to meet up. If you have Customer Success Manager at Jamf, please feel free to connect with them and we can coordinate a time to meet. (I would put my contact info on here, but would prefer to go through official channels if that is okay with you.)
Just let them know that Chris Zimmerman asked to connect!
Hey @chrisgzim
Ok, so using the code from Development, I get the following:
Script result: 2024-07-18 16:46:50 - PRE-FLIGHT CHECK: swiftDialog version 2.5.0.4768 found; proceeding... 2024-07-18 16:47:29 - API Credentials work, invalidating token 2024-07-18 16:47:29 - Token already invalid 2024-07-18 16:47:29 - Workflow Selected: Static / Smart Group. Password Option: Set your own. 2024-07-18 16:47:41 - Computer Group Selected is 153 2024-07-18 16:47:41 - Found old csv, deleting now 2024-07-18 16:47:41 - Found old python script, deleting now 2024-07-18 16:47:42 - number of computers returned: 446 -:1: parser error : StartTag: invalid element name <!doctype html>
HTTP Status 404 – Not Found</title ^ -:1: parser error : Extra content at the end of the document <!doctype html> HTTP Status 404 – Not Found</title ^ 2024-07-18 16:47:43 - ERROR: Nothing returned from computer group 153
I thought I would also try it with a Static Group (the above is a smart group) with the same results
Script result: 2024-07-18 16:51:50 - PRE-FLIGHT CHECK: swiftDialog version 2.5.0.4768 found; proceeding... 2024-07-18 16:58:10 - API Credentials work, invalidating token 2024-07-18 16:58:10 - Token already invalid 2024-07-18 16:58:10 - Workflow Selected: Static / Smart Group. Password Option: Set your own. 2024-07-18 16:58:23 - Computer Group Selected is 159 2024-07-18 16:58:23 - Found old csv, deleting now 2024-07-18 16:58:23 - Found old python script, deleting now 2024-07-18 16:58:24 - number of computers returned: 446 -:1: parser error : StartTag: invalid element name <!doctype html>
HTTP Status 404 – Not Found</title ^ -:1: parser error : Extra content at the end of the document <!doctype html> HTTP Status 404 – Not Found</title ^ 2024-07-18 16:58:25 - ERROR: Nothing returned from computer group 159
Official channels is also good with me. Thanks for all your help.
Okay, I'll look forward to connecting. I would be curious why the credentials seem to work at Bearer Token and the JPAPI call, but not on the Classic API call. But will definitely want to take a call on this.
Hi Chris. Not really an issue, probably user error. I just have a question about the group ID.
I've got a smart group that I would like to set recovery lock on, however, every time i use either the Group ID or UUID, I get the following message
For the ID i am using (in the instance below) 153![2](https://github.com/chrisgzim/Jamf-API-Recovery-Lock-by-Group/assets/61380535/2fda62f8-2501-4409-b5bb-9f02b9a602f8)
I even tried the UUID from the results of the group![3](https://github.com/chrisgzim/Jamf-API-Recovery-Lock-by-Group/assets/61380535/2da08d36-657c-496a-9da5-e2dbff58a84f)
Nothing seems to be working.
The serials and management IDs exist in the system. If i try and do them using the serial rather than group, it works OK.![4](https://github.com/chrisgzim/Jamf-API-Recovery-Lock-by-Group/assets/61380535/58d84e3c-21e1-495f-a988-c09ec27f943e)
Any ideas?