jssimporter / JSSImporter

JSSImporter is deprecated. Please see the wiki for alternatives
Apache License 2.0
145 stars 38 forks source link

Limit to Smartgroup computer objects when JSSImporter runs verification #186

Open Will-l88 opened 3 years ago

Will-l88 commented 3 years ago

Hi, When running JSSImporter with the switch --key STOP_IF_NO_JSS_UPLOAD=False to update an existing smartgroup/policy/package

I am getting the following error:

JSSImporter: Looking for ComputerGroup template file SmartGroupTemplatel.xml... JSSImporter: Found file: /Users//Library/AutoPkg/RecipeOverrides/SmartGroupTemplate.xml Response Code: 504 Response: https://**.jamfcloud.com/JSSResource/computergroups/id/562. Failed.

However if I delete the smartgroup it works perfectly fine. If I manually change the smartgroup first to have less computer object it also works.

When it works FYI:

JSSImporter: Looking for ComputerGroup template file SmartGroupTemplate.xml... JSSImporter: Found file: /Users//Library/AutoPkg/RecipeOverrides/SmartGroupTemplate.xml JSSImporter: ComputerGroup ID '562' verified on server JSSImporter: ComputerGroup 'Software Not Installed - **' updated.

I believe the issue may be a limit set on the number of computer objects in the smart group the script has to verify, is this the case ? Currently in the smart group there are around 2500 computers.

Thanks very much,

grahampugh commented 3 years ago

Hi, that's an interesting theory. Many users have reported this and I produced a patch which ignores the 504 error. If you use the package here, you should not get the error:

https://github.com/jssimporter/JSSImporter/releases/tag/v1.1.2-patch

Will-l88 commented 3 years ago

Hi, thanks very much for the quick response. I've checked the Jamf thread (https://www.jamf.com/jamf-nation/discussions/36631/classic-api-problem-uploading-computer-groups) and it does seem to be very similar issue but I'm getting 504 but the fix mentions 502.

Before I try it, do you happen to know if its related, just want to be sure as the patch will be potentially installed on our production / live system.

grahampugh commented 3 years ago

Ah, yes you are right, this patch only works around 502 errors, not 504. I'm not sure there is anything that can be done about 504 as it is a genuine timeout error. We usually only see this with the package upload. I did some testing about trying to increase timeout limits but the Jamf servers do not seem to allow it.

You could try ignoring all 504 errors as well as 502 I suppose and see if that works. To do this you need to edit the following file:

/Library/AutoPkg/JSSImporter/jss/jamf_software_server.py

Change line 440 to:

        elif response.status_code == 502 or response.status_code == 504:
Will-l88 commented 3 years ago

Perfect, that seems to have done the trick.

So potentially this may get resolved when/if Jamf do an update on their end ?

grahampugh commented 3 years ago

I think 504 is a more fundamental issue, that I would be surprised if got fixed soon. I've asked for feedback on the 502 a couple of times and got tumbleweed. I think I'll roll this change into a new release... watch this space.