I'm attempting to create a configuration profile during a recipe run to place update metadata on devices for later use. One piece of data included in the profile is the size of the update package. I've found that when this key is added to my payload template, the profile processor step in my recipe fails. This failure occurs regardless of if the payload specifies it as <integer> or <string>. If I remove the variable containing the integer or substitute it with something non-numeric, the profile is created and uploaded successfully.
Additionally, my forked version of the PkgInfoReader processor is required in order to get the %installer_item_size% value. I also have a pull request open to merge the update into the main processor.
Here's a sanitized -vvvv output of the ComputerProfileUploader step in a failed run:
com.github.grahampugh.jamf-upload.processors/JamfComputerProfileUploader
{'Input': {'API_PASSWORD': 'redacted',
'API_USERNAME': 'redacted',
'JSS_URL': 'redacted',
'identifier': 'redacted',
'organization': 'AutoPkg',
'payload': 'payloadTemplate.plist',
'profile_category': 'AutoPkg',
'profile_computergroup': 'redacted',
'profile_name': 'App Update Data: 1Password',
'profile_template': 'ConfigProfileTemplate-autopatch.xml',
'replace_profile': 'True',
'sleep': '0'}}
JamfComputerProfileUploader: No value supplied for unsign_profile, setting default value of: False
JamfComputerProfileUploader: Matching dir: /Users/user/Documents/GitHub/redacted/autopkg/RecipeOverrides
JamfComputerProfileUploader: File found at: /Users/user/Documents/GitHub/redacted/autopkg/RecipeOverrides/ConfigurationProfileTemplates/payloadTemplate.plist
JamfComputerProfileUploader: Matching dir: /Users/user/Documents/GitHub/redacted/autopkg/RecipeOverrides
JamfComputerProfileUploader: File found at: /Users/user/Documents/GitHub/redacted/autopkg/RecipeOverrides/ConfigurationProfileTemplates/ConfigProfileTemplate-autopatch.xml
JamfComputerProfileUploader: Checking for existing 'App Update Data: 1Password' on redacted
JamfComputerProfileUploader: Checking for existing authentication token
JamfComputerProfileUploader: No existing valid token found
JamfComputerProfileUploader: Getting an authentication token using Basic Auth
JamfComputerProfileUploader: Output file is: /tmp/jamf_upload_h82d_fhp/jamf_upload_sbjv8mxw.txt
JamfComputerProfileUploader: curl command: /usr/bin/curl --dump-header /tmp/jamf_upload_h82d_fhp/curl_headers_from_jamf_upload.txt https://redacted.jamfcloud.com/api/v1/auth/token --request POST --silent --show-error --header authorization: Basic redacted --header Content-type: application/json --output /tmp/jamf_upload_h82d_fhp/jamf_upload_sbjv8mxw.txt --cookie-jar /tmp/jamf_upload_h82d_fhp/curl_cookies_from_jamf_upload.txt --cookie /tmp/jamf_upload_h82d_fhp/curl_cookies_from_jamf_upload.txt
JamfComputerProfileUploader: Session token received
JamfComputerProfileUploader: Token: redacted
JamfComputerProfileUploader: Expires: 2023-08-30T20:06:13.051Z
JamfComputerProfileUploader: Output file is: /tmp/jamf_upload_h82d_fhp/jamf_upload_jj3n9pbi.txt
JamfComputerProfileUploader: curl command: /usr/bin/curl --dump-header /tmp/jamf_upload_h82d_fhp/curl_headers_from_jamf_upload.txt https://redacted.jamfcloud.com/JSSResource/osxconfigurationprofiles --request GET --silent --show-error --header authorization: Bearer redacted --header Accept: application/json --output /tmp/jamf_upload_h82d_fhp/jamf_upload_jj3n9pbi.txt --cookie-jar /tmp/jamf_upload_h82d_fhp/curl_cookies_from_jamf_upload.txt --cookie /tmp/jamf_upload_h82d_fhp/curl_cookies_from_jamf_upload.txt
JamfComputerProfileUploader: Configuration Profile 'App Update Data: 1Password' already exists: ID 187
JamfComputerProfileUploader: Output file is: /tmp/jamf_upload_h82d_fhp/jamf_upload_jjnzo9h1.txt
JamfComputerProfileUploader: curl command: /usr/bin/curl --dump-header /tmp/jamf_upload_h82d_fhp/curl_headers_from_jamf_upload.txt https://redacted.jamfcloud.com/JSSResource/osxconfigurationprofiles/id/187 --request GET --silent --show-error --header authorization: Bearer redacted --header Accept: application/json --output /tmp/jamf_upload_h82d_fhp/jamf_upload_jjnzo9h1.txt --cookie-jar /tmp/jamf_upload_h82d_fhp/curl_cookies_from_jamf_upload.txt --cookie /tmp/jamf_upload_h82d_fhp/curl_cookies_from_jamf_upload.txt
JamfComputerProfileUploader: {redacted (existing profile data)}
JamfComputerProfileUploader: Value of 'general/payloads': redacted
JamfComputerProfileUploader: Existing payload (type: <class 'bytes'>):
JamfComputerProfileUploader: Imported payload
JamfComputerProfileUploader: ("Replacing any instances of 'APP_BUNDLE_ID' with", "'com.1password.1password'")
JamfComputerProfileUploader: ("Replacing any instances of 'NAME' with", "'1Password'")
JamfComputerProfileUploader: ("Replacing any instances of 'version' with", "'8.10.13'")
JamfComputerProfileUploader: ("Replacing any instances of 'version_regex' with", "'^(\\d{2,}.*|9.*|8\\.\\d{3,}.*|8\\.[2-9]\\d{1,}.*|8\\.1[1-9].*|8\\.10\\.\\d{3,}.*|8\\.10\\.[2-9]\\d{1,}.*|8\\.10\\.1[4-9].*|8\\.10\\.13.*)$'")
JamfComputerProfileUploader: ("Replacing any instances of 'version_regex_2' with", "'^$'")
JamfComputerProfileUploader: ("Replacing any instances of 'version_regex_3' with", "'^$'")
JamfComputerProfileUploader: ("Replacing any instances of 'DEFER_LIMIT' with", "'10'")
JamfComputerProfileUploader: ("Replacing any instances of 'FORCE_UPDATE' with", "'False'")
JamfComputerProfileUploader: ("Replacing any instances of 'ROLLBACK' with", "'False'")
JamfComputerProfileUploader: ("Replacing any instances of 'installer_item_size' with", "'254271547'")
Traceback (most recent call last):
File "/Library/AutoPkg/autopkglib/__init__.py", line 873, in process
self.env = processor.process()
File "/Library/AutoPkg/autopkglib/__init__.py", line 656, in process
self.main()
File "/Users/user/Library/AutoPkg/RecipeRepos/com.github.grahampugh.jamf-upload/JamfUploaderProcessors/JamfComputerProfileUploader.py", line 529, in main
mobileconfig_plist = self.make_mobileconfig_from_payload(
File "/Users/user/Library/AutoPkg/RecipeRepos/com.github.grahampugh.jamf-upload/JamfUploaderProcessors/JamfComputerProfileUploader.py", line 184, in make_mobileconfig_from_payload
payload_text = self.substitute_assignable_keys(
File "/Users/user/Library/AutoPkg/RecipeRepos/com.github.grahampugh.jamf-upload/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py", line 598, in substitute_assignable_keys
replacement_key = escape(self.env.get(found_key))
File "/Library/AutoPkg/Python3/Python.framework/Versions/3.10/lib/python3.10/xml/sax/saxutils.py", line 27, in escape
data = data.replace("&", "&")
AttributeError: 'int' object has no attribute 'replace'
File "/Library/AutoPkg/autopkglib/__init__.py", line 873, in process
self.env = processor.process()
'int' object has no attribute 'replace'
Failed.
Receipt written to /Users/user/Library/AutoPkg/Cache/local.jamf.1Password8/receipts/1Password8-receipt-20230830-153613.plist
The following recipes failed:
1Password8.jamf
Error in local.jamf.1Password8: Processor: com.github.grahampugh.jamf-upload.processors/JamfComputerProfileUploader: Error: 'int' object has no attribute 'replace'
I'm attempting to create a configuration profile during a recipe run to place update metadata on devices for later use. One piece of data included in the profile is the size of the update package. I've found that when this key is added to my payload template, the profile processor step in my recipe fails. This failure occurs regardless of if the payload specifies it as
<integer>
or<string>
. If I remove the variable containing the integer or substitute it with something non-numeric, the profile is created and uploaded successfully.This should be reproducible with the following recipes and templates from my repo: Recipe: 1Password8.jamf Profile template: ConfigProfileTemplate-autopatch.xml Payload template: payloadTemplate.plist
Additionally, my forked version of the
PkgInfoReader
processor is required in order to get the%installer_item_size%
value. I also have a pull request open to merge the update into the main processor.Here's a sanitized
-vvvv
output of theComputerProfileUploader
step in a failed run: