Skip to content

[BUG] Cannot pass limit_to_users with JamfPolicyUploader #192

Description

@technotica

Describe the bug
Package is being uploaded to Jamf without issues. I believe the problems started when we changed SSO providers from Okta to Entra ID and enabled Microsoft Entra ID Integration in Jamf. We were previously using LDAP for user groups.

Failure Message:
Error in local.jamf.AmazonCorretto: Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader: Error: byte indices must be integers or slices, not str

Running as -vvv:

JamfPolicyUploader: API response:
b'<html>\n<head>\n   <title>Status page</title>\n</head>\n<body style="font-family: sans-serif;">\n<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Conflict</p>\n<p>Error: Problem matching limit_to_users user group </p>\n<p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10">here</a>.<br>\nPlease continue your visit at our <a href="/">home page</a>.\n</p>\n</body>\n</html>\n'
Traceback (most recent call last):
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
  File "/Library/AutoPkg/autopkglib/__init__.py", line 626, in process
    self.main()
  File "/Users/runner/work/Jamf-Actions/Jamf-Actions/repos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPolicyUploader.py", line 127, in main
    self.execute()
  File "/Users/runner/work/Jamf-Actions/Jamf-Actions/repos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfUploaderLib/JamfPolicyUploaderBase.py", line 295, in execute
    r = self.upload_policy(
  File "/Users/runner/work/Jamf-Actions/Jamf-Actions/repos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfUploaderLib/JamfPolicyUploaderBase.py", line 103, in upload_policy
    if self.status_check(r, "Policy", policy_name, request) == "break":
  File "/Users/runner/work/Jamf-Actions/Jamf-Actions/repos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py", line 548, in status_check
    description = r.output["errors"][0]["description"]
TypeError: byte indices must be integers or slices, not str
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
Receipt written to /Users/runner/Library/AutoPkg/Cache/local.jamf.AmazonCorretto/receipts/AmazonCorretto.jamf-receipt-20250128-195952.plist
The following recipes failed:
    overrides/AmazonCorretto.jamf.recipe
        Error in local.jamf.AmazonCorretto: Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader: Error: byte indices must be integers or slices, not str

I'm not sure if there is a problem with Jamf API or how JamfPolicyUploader is passing our user group data. I suspect it is a problem with the Jamf API, which I wouldn't expect you to fix. But given the error message from JamfPolicyUploader is confusing, I thought it merited an issue report to see if error messaging for Jamf Upload could be improved in the future.

To Reproduce
JamfPolicyUploader only fails when using the attached Jamf Template xml.

Expected behaviour
Maybe instead of reporting back with 'Error: byte indices must be integers or slices, not str' say something like "Your Jamf Template XML is malformed. Here's the specific API response that failed: . "

Log output
See attached log, Jamf template, and jamf recipe.

Environment (please complete the following information):

  • OS: macOS 15
  • AutoPkg 2.7.3
  • Usingautopkg/grahampugh-recipes

Additional context
I have tried both including and excluding the group ID in limit_to_users, but still not working. I reviewed the policy XML from grabbing the policy ID from our the Jamf API directly. The group name and ID matches what is being passed to the Jamf template.

[AmazonCorretto-output.txt](https://github.com/user-attachments/files/

AmazonCorretto-Template and Recipe.zip

18579090/AmazonCorretto-output.txt)

Metadata

Metadata

Assignees

Labels

answeredAnswered, awaiting response if required (will be closed after a while if no response given)bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions