Code Monkey home page Code Monkey logo

jamf-upload's Introduction

Currently most active projects ๐Ÿง‘๐Ÿผโ€๐Ÿ’ป

My most popular and demanding project is ๐Ÿ—‚๏ธ erase-install, a zsh script for upgrading, reinstalling and erasing macOS. This was updated significantly in 2022 to use mist-cli and swiftDialog, and has to keep pace with changes to those projects as well as changes to macOS itself.

My other most used project is JamfUploader. This is a collection of python processors for use with AutoPkg which is the dominant method for integrating AutoPkg with Jamf Pro. 2023 saw significant updates to the JamfPackageUploader processor, after Jamf provided a new version of their Cloud Distribution Service (JCDS 2.0) and provided an official package upload API endpoint/method for the first time.

These processors are also mirrored in my AutoPkg recipes repo, grahampugh-recipes, along with a large collection of recipes and examples of how to write .jamf recipes.

Other notable projects ๐Ÿ“

For those interested in an easy script for setting up AutoPkg on a fresh machine, including (optionally) configuring JamfUploader, check out AutoPkgSetup.

If you need a signed package to add to your MDM to install Rosetta 2 at enrollment, check out Rosetta-2-install.

If you want a tool that is somewhat like a lightweight Nudge, which doesn't require any configuration changes with time, check out Nice Updater 2. Note that this is a highly altered fork of the original project by Ryan Ball, which you can check out at ryangball/nice-updater.

If you need to convert PLIST files to YAML, or vice versa, check out plist-yaml-plist.

Deprecations โ˜ ๏ธ

The projects based on python-jss that I inherited from Shea Craig, namely JSSImporter, Spruce, jss_helper, JSSRecipeCreator, and python-jss itself, are all now deprecated. You can still find the code in the JSSImporter organisation.

jamf-upload's People

Contributors

cr3ation avatar davidbpirie avatar dependabot[bot] avatar doschupp avatar grahampugh avatar jamesfkane avatar jc0b avatar jonesiscoding avatar jwrn3 avatar marschelloss avatar mhrono avatar mlbz521 avatar mosen avatar mpanighetti avatar novaksam avatar pandemicus avatar petetoscano avatar picomitchell avatar rickokid avatar wardsparadox avatar zackn9ne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jamf-upload's Issues

JamfComputerGroupUploader Error Finding Template

I have a local repo with the following structure
Main
-> JAMF_PreProduction_Policies
-->SomeRecipe.jamf.recipe.yaml
-> Templates
--> JAMF-StaticGroup.xml

So basically the at the root, I have two directories, one with all the recipes, and another with templates. In an earlier release of this processor, everything was working fine. I recently updated and now getting where it cannot find the template xml. Here is an output of the error

JamfComputerGroupUploader: Matching dir: /Users/autopkg/Library/AutoPkg/RecipeOverrides
JamfComputerGroupUploader: Looking for JAMF-StaticGroup.xml in /Users/autopkg/Library/AutoPkg/RecipeOverrides
JamfComputerGroupUploader: Matching dir: /Users/autopkg/Library/AutoPkg/RecipeOverrides
JamfComputerGroupUploader: Parent Recipe: /Volumes/DataVolume01/Autopkg/LocalRecipes/JAMF_PreProduction_Policies/SomeRecipe.jamf.recipe.yaml
JamfComputerGroupUploader: Matching dir: /Volumes/DataVolume01/Autopkg/LocalRecipes/JAMF_PreProduction_Policies
JamfComputerGroupUploader: Matching dir: /Volumes/DataVolume01/Autopkg/LocalRecipes/JAMF_PreProduction_Policies
JamfComputerGroupUploader: Matching dir: /Volumes/DataVolume01/Autopkg/LocalRecipes/JAMF_PreProduction_Policies
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 "/Volumes/DataVolume01/Autopkg/RecipeRepo/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfComputerGroupUploader.py", line 170, in main
    raise ProcessorError(
autopkglib.ProcessorError: ERROR: Computer Group file JAMF-StaticGroup.xml not found
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
ERROR: Computer Group file JAMF-StaticGroup.xml not found
Failed.

What I figured out is that I needed to add to the search directories the current directory I was operating in. Even though my search directories is set with a '.', the processor was not searching it.

At least this could be documented or another condition can be added to search within the current directory IF there is a '.' in the existing REPO_SEARCH_DIR array.

Update authentication method to token-based

Jamf have announced that authentication of the Classic API will be done via token, which is generated using basic auth to the token-generating endpoint, as with the Jamf Pro API.

This has been enabled in Jamf Pro 10.35. The user-based authentication is still available at present, but can be disabled in a future version of Jamf Pro and will be removed later this year.

This means we need to retain both methods for the time being.

Tripping over substitute_assignable_keys

It seems that in jamf_script_upload.py, line 55 is getting tripped up when trying to upload a script that has contains two % characters. For example, I have a script that that uses the Jamf API that I am uploading, and in my script I am escaping HTML spaces, with something like: "$SERVER"/JSSResource/scripts/name/My%20Great%20Script.

It is seeing these % characters as surrounding a variable even though I am not providing any --key args.

Ideally, the AutoPkg processors could be run as the standalone scripts so we don't have to maintain both

Since the code is slightly different between the standalone scripts and the AutoPkg processors, it's slightly tedious to merge in changes from one to the other.

It should be possible to create a wrapper script that translates the command line command into a processor run, as per https://github.com/autopkg/autopkg/wiki/Developing-Custom-Processors

This will require that AutoPkg is installed on the devices running the standalone scripts, but this is already effectively the case due to the python3 framework required.

Feature request: Support for new Failover URLs

Jamf Pro 10.45.0 introduced Failover URL Update for Single Sign-On Integrations:

New instances of Jamf Pro 10.45.0 or later enabling single sign-on (SSO) for the first time will have a failover login URL that includes a string of randomized characters for improved security.

With Jamf Pro instances using SSO, when you're trying to upload a package with JamfPackageUploader with the jcds_mode set to True, your Autopkg service account will require Update privilege on SSO settings. However, with the new Failover URLs, this will not be enough, at least according to my tests. I would like to suggest an update to the processor (please be aware I have a very basic understanding of Python and I don't know how to submit a PR ๐Ÿ˜‰).

In the current version of JamfPackageUploader the function create_session contains the following line: url = jamf_url + "/?failover" which takes care of SSO without the randomized string. In order for it to work with the string, a few changes would need to be implemented.

My suggetsions:

At Line 192 (within input_variables):

"failover_id": {
    "required": False,
    "description": "Add string of randomized characters to the Jamf Failover URL",
    "default": "",
},

At Line 408:

def create_session(self, jamf_url, user, password, failover_id):
        """create session cookies for the package upload endpoint"""
        url = jamf_url + "/?failover=" + failover_id

At Line 670:

self.failover_id=self.env.get("failover_id")

At Line 882:

self.create_session(
	self.jamf_url, self.jamf_user, self.jamf_password, self.failover_id

Thanks to these changes, we could then include a flag -k failover_id=xxx in the autopkg command or even set a global variable in global Autopkg preferences plist file. I have tested this on my Jamf Beta instance with Okta SSO and it worked.

Can not configure DPs

AutoPkg 2.4.1, AutoPkgr 1.6, current jamf-upload, macOS 12.4, M1
In the Intergrations section of AutoPkgr, when configuring JamfUploader with DP settings of type Local, SMB or AFP I'm only able to enter anything in the Password field, and Port for SMB and AFP. All of the other fields are uneditable. So I'm not able to save the configuration

Replacing a group fails via JamfComputerGroupUploader

When using a computer group name that contains the %version% variable the upload fails if that computer group already exists.

Here is the very verbose log containing the relevant failures:

{'Input': {'API_PASSWORD': 'API_PASS',
           'API_USERNAME': 'API_USER',
           'JSS_URL': 'JSS_URL',
           '**computergroup_name': 'USS.FIREFOX.ALL.NEEDS.%version%**',
           'computergroup_template': 'USS_UPDATE_GROUP_PM_TEMPLATE.xml',
           'replace_group': True}}
JamfComputerGroupUploader: File found at: /Users/ussadmin/grahampugh-recipes/Jamf_Recipes/USS_UPDATE_GROUP_PM_TEMPLATE.xml
**JamfComputerGroupUploader: Checking for existing 'USS.FIREFOX.ALL.NEEDS.%version%' on JSS_URL**
JamfComputerGroupUploader: No existing cookie found - starting new session
JamfComputerGroupUploader: ("Replacing any instances of 'UPDATE_GROUP_NAME' with", "'USS.FIREFOX.ALL.NEEDS.%version%'")
JamfComputerGroupUploader: ("Replacing any instances of 'SITE' with", "'USS'")
JamfComputerGroupUploader: ("Replacing any instances of 'PATCH_MANAGEMENT_TITLE' with", "'Mozilla Firefox'")
JamfComputerGroupUploader: ("Replacing any instances of 'version' with", "'95.0.2'")
JamfComputerGroupUploader: Computer Group data:
JamfComputerGroupUploader: <?xml version="1.0" encoding="UTF-8"?>
<computer_group>
	<name>USS.FIREFOX.ALL.NEEDS.95.0.2</name>
	<is_smart>true</is_smart>
	<site>
			<name>USS</name>
	</site>	
	<criteria>
		<criterion>
	        <name>Patch Reporting: Mozilla Firefox</name>
			<priority>0</priority>
			<and_or>and</and_or>
			<search_type>less than</search_type>
			<value>95.0.2</value>
			<opening_paren>false</opening_paren>
			<closing_paren>false</closing_paren>
      </criterion>
	</criteria>
</computer_group>
JamfComputerGroupUploader: Uploading Computer Group...
JamfComputerGroupUploader: Computer Group upload attempt 1
JamfComputerGroupUploader: Existing cookie found: APBALANCEID=aws.usw2-std-ellison1-tc-10
JamfComputerGroupUploader: 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: Duplicate name</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'**
Receipt written to /Users/ussadmin/Library/AutoPkg/Cache/com.github.grahampugh.recipes.jamf.Firefox/receipts/Firefox_Prod.jamf.recipe-receipt-20211221-101336.plist
The following recipes failed:
    **Firefox_Prod.jamf.recipe.yaml
        Error in com.github.grahampugh.recipes.jamf.Firefox: Processor: com.github.grahampugh.jamf-upload.processors/JamfComputerGroupUploader: Error: WARNING: Computer Group 'USS.FIREFOX.ALL.NEEDS.%version%' upload failed due to a conflict**
The following computer groups were created or updated in Jamf Pro:

And then here is my full recipe:

Description: |

Identifier: com.github.jshirle2.recipes.jamf.Firefox
MinimumVersion: "2.3"
ParentRecipe: com.github.autopkg.pkg.Firefox_EN

Input:
  NAME: FIREFOX
  SITE: "USS"
  PATCH_MANAGEMENT_TITLE: "Mozilla Firefox"
  PACKAGE_CATEGORY: "USS - EDM - Prod"
  TESTING_CATEGORY: "USS - EDM - Test"
  TESTING_GROUP_NAME: "USS.%NAME%.TESTERS"
  TESTING_GROUP_TEMPLATE: "USS_TESTING_GROUP_TEMPLATE.xml"
  TESTING_POLICY_NAME: "USS.%NAME%.%version%.TEST"
  TESTING_POLICY_TEMPLATE: "USS_TESTING_POLICY_TEMPLATE.xml"
  FUNCTION_POLICY_NAME: "USS.%NAME%.%version%.INSTALL"
  FUNCTION_CATEGORY: "Functions - Apps"
  FUNCTION_POLICY_TEMPLATE: "USS_FUNCTION_POLICY_TEMPLATE.xml"
  UPDATE_GROUP_NAME: "USS.FIREFOX.ALL.NEEDS.%version%"
  UPDATE_GROUP_TEMPLATE: "USS_UPDATE_GROUP_PM_TEMPLATE.xml"
  UPDATE_POLICY_NAME: "USS.%NAME%.UPDATE"
  UPDATE_POLICY_FREQUENCY: "Once every day"
  UPDATE_POLICY_CATEGORY: "Updates"
  UPDATE_POLICY_TEMPLATE_FACSTAFF: "USS_UPDATE_POLICY_FACSTAFF_TEMPLATE.xml"
  UPDATE_POLICY_TEMPLATE_APPLIANCE: "USS_UPDATE_POLICY_APPLIANCE_TEMPLATE.xml"
  SELF_SERVICE_DISPLAY_NAME: "Install %NAME% %version%"
  SELF_SERVICE_DESCRIPTION: "Mozilla Firefox is a free and open source web browser."
  SELF_SERVICE_ICON: "%NAME%.png"
  INSTALL_BUTTON_TEXT: "Install %version%"
  REINSTALL_BUTTON_TEXT: "Install %version%"

Process: 
  - Processor: com.github.grahampugh.jamf-upload.processors/JamfPackageUploader
    Arguments: 
      pkg_category: "%PACKAGE_CATEGORY%"

  - Processor: com.github.grahampugh.recipes.commonprocessors/VersionRegexGenerator

  - Processor: com.github.grahampugh.jamf-upload.processors/JamfComputerGroupUploader
    Arguments:
      computergroup_name: "%TESTING_GROUP_NAME%"
      computergroup_template: "%TESTING_GROUP_TEMPLATE%"
      replace_group: true

  - Processor: com.github.grahampugh.jamf-upload.processors/JamfComputerGroupUploader
    Arguments:
      computergroup_name: "%UPDATE_GROUP_NAME%"
      computergroup_template: "%UPDATE_GROUP_TEMPLATE%"
      replace_group: true

  - Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
    Arguments:
      policy_template: "%TESTING_POLICY_TEMPLATE%"
      policy_name: "%TESTING_POLICY_NAME%"
      icon: "%SELF_SERVICE_ICON%"
      replace_policy: true
  
  - Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
    Arguments: 
      policy_template: "%FUNCTION_POLICY_TEMPLATE%"
      policy_name: "%FUNCTION_POLICY_NAME%"
      replace_policy: true

  - Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
    Arguments: 
      policy_template: "%UPDATE_POLICY_TEMPLATE_FACSTAFF%"
      policy_name: "%UPDATE_POLICY_NAME%.FACSTAFF.LOANERS.SHAREDEMPLOYEELOCAL"
      replace_policy: true

[Errno 2] No such file or directory: '/Volumes/JAMFShare/Packages/xxxxx.pkg using Multi DP

Repost from Slack as requested:

First my environment if it is relevant is Jamf cloud with a secondary local SMB FSDP. The MacBook running AutoPkg is an M1 running Ventura.
I'm getting [Errno 2] No such file or directory: '/Volumes/JAMFShare/Packages/xxxxx.pkg Other references to this error don't seem to mirror my experience
This error seems to occur under two circumstances:

  1. If a recipe doesn't have to copy a file to the FSDP share because it already exists. Many times it doesn't seem to dismount the share and the next recipe run fails with the aforementioned error. Manually dismounting allows the recipe to run correctly
  2. If any other SMB share is mounted, it is always dismounted and the recipe will intermittently fail as above
    Additionally if the process doesn't fail because of another mounted volume then it will leave the FSDP volume mounted causing the next recipe to fail

Output of the first scenario occurring.
Recipe that generated this output

Thanks

"You are attempting to connect to the server" when using SMB

My Jamf distribution point mounts over SMB. I set the SMB_URL and username and password and when autopkg runs the Finder shows the dialog "You are attempting to connect to the server... Click Connect to continue." Is there any way to get rid of the dialog so this can be automated?

I'm using a tart VM with macOS 12.5.1 and the latest versions of autopkg and this repo.

JamfPackageUploader fails with error `upload failed due to permissions error`

As discussed in Slack

A truncated and partially sanitized log displaying the issue:

JamfPackageUploader: Checking for existing 'BBEdit-14.0.2.pkg' on https://tenant.jamfcloud.com/
JamfPackageUploader: No existing cookie found - starting new session
...
JamfPackageUploader: Package 'BBEdit-14.0.2.pkg' already exists: ID 75
JamfPackageUploader: Replacing existing package as 'replace_pkg' is set to True
...
JamfPackageUploader: HTTP response: 401
JamfPackageUploader: Package uploaded successfully, ID=-1
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/haircut/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPackageUploader.py", line 688, in main
    if not self.status_check(r, "Package", self.pkg_name) == "break":
  File "/Users/haircut/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPackageUploader.py", line 328, in status_check
    f"ERROR: {endpoint_type} '{obj_name}' upload failed due to permissions error"
autopkglib.ProcessorError: ERROR: Package 'BBEdit-14.0.2.pkg' upload failed due to permissions error
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
ERROR: Package 'BBEdit-14.0.2.pkg' upload failed due to permissions error

Confirmed the issue exists on macOS 11.6.1 and 12.0.1, on multiple computers, across user accounts.

JamfUploaderSlacker - category information not being included in posts to Slack

Posts to a Slack channel using the JamfUploaderSlacker processor are succeeding, but category information is not being posted.

Screen Shot 2022-02-07 at 9 16 50 AM

Here's the relevant output from a verbose AutoPkg run:

com.github.grahampugh.jamf-upload.processors/JamfPackageUploader
{'Input': {'API_PASSWORD': 'password_goes_here',
           'API_USERNAME': 'username_goes_here',
           'JSS_URL': 'https://jamf.pro.server.here',
           'pkg_category': 'Apps',
           'pkg_notes': 'Cisco Umbrella 3.0.5 installer uploaded via AutoPkg.',
           'pkg_path': '/Users/username/Library/AutoPkg/Cache/local.jamf.CiscoUmbrella/Cisco_Umbrella_3.0.5.pkg',
           'pkg_priority': '6',
           'version': '3.0.5'}}
JamfPackageUploader: No value supplied for pkg_name, setting default value of: 
JamfPackageUploader: No value supplied for pkg_info, setting default value of: 
JamfPackageUploader: No value supplied for reboot_required, setting default value of: 
JamfPackageUploader: No value supplied for os_requirements, setting default value of: 
JamfPackageUploader: No value supplied for required_processor, setting default value of: None
JamfPackageUploader: No value supplied for send_notification, setting default value of: 
JamfPackageUploader: No value supplied for replace_pkg, setting default value of: False
JamfPackageUploader: No value supplied for replace_pkg_metadata, setting default value of: False
JamfPackageUploader: No value supplied for SMB_URL, setting default value of: 
JamfPackageUploader: No value supplied for SMB_USERNAME, setting default value of: 
JamfPackageUploader: No value supplied for SMB_PASSWORD, setting default value of: 
JamfPackageUploader: Checking for existing 'Cisco_Umbrella_3.0.5.pkg' on https://jamf.pro.server.here
JamfPackageUploader: Checking for existing authentication token
JamfPackageUploader: Checking https://jamf.pro.server.here against https://jamf.pro.server.here
JamfPackageUploader: URL for token matches current request
JamfPackageUploader: Existing token is valid
JamfPackageUploader: Existing cookie found: APBALANCEID=aws.euc1-std-ellison1-tc-15
JamfPackageUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://jamf.pro.server.here/api/v1/jamf-pro-version --request GET --header authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMGRiNDg2NDMtMjBiZi00MjlhLWFkM2UtYmY2ZjA3MThhNWJkIiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiI0IiwiZXhwIjoxNjQ0MjQ1MTYwfQ.eDJNWhsqFTnWqS1CE_4HcKXkFHy-j_U0t4C2spTjKUs --header Accept: application/json --cookie APBALANCEID=aws.euc1-std-ellison1-tc-15
JamfPackageUploader: Jamf Pro Version: 10.35.0-t1640197529
JamfPackageUploader: Token auth will be used, 
JamfPackageUploader: Existing cookie found: APBALANCEID=aws.euc1-std-ellison1-tc-15
JamfPackageUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://jamf.pro.server.here/JSSResource/packages/name/Cisco_Umbrella_3.0.5.pkg --request GET --header authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMGRiNDg2NDMtMjBiZi00MjlhLWFkM2UtYmY2ZjA3MThhNWJkIiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiI0IiwiZXhwIjoxNjQ0MjQ1MTYwfQ.eDJNWhsqFTnWqS1CE_4HcKXkFHy-j_U0t4C2spTjKUs --header Accept: application/json --cookie APBALANCEID=aws.euc1-std-ellison1-tc-15
JamfPackageUploader: ID: -1
JamfPackageUploader: Existing cookie found: APBALANCEID=aws.euc1-std-ellison1-tc-15
JamfPackageUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://jamf.pro.server.here/dbfileupload --request POST --header authorization: Basic amFtZnByby1hdXRvcGtnOkVBSFVCV0tzOVQyWTk2ektuZExIM0haN01RVkxQM1BRZUx0c3dYM2F1Smc1QkhTNkhk --upload-file /Users/username/Library/AutoPkg/Cache/local.jamf.CiscoUmbrella/Cisco_Umbrella_3.0.5.pkg --header Accept: application/xml --cookie APBALANCEID=aws.euc1-std-ellison1-tc-15 --header DESTINATION: 0 --header OBJECT_ID: -1 --header FILE_TYPE: 0 --header FILE_NAME: Cisco_Umbrella_3.0.5.pkg --max-time 3600
JamfPackageUploader: HTTP response: 200
JamfPackageUploader: Package uploaded successfully, ID=21
JamfPackageUploader: Package 'Cisco_Umbrella_3.0.5.pkg' upload successful
JamfPackageUploader: Updating package metadata for 21
JamfPackageUploader: <package><name>Cisco_Umbrella_3.0.5.pkg</name><filename>Cisco_Umbrella_3.0.5.pkg</filename><category>Apps</category><info></info><notes>Cisco Umbrella 3.0.5 installer uploaded via AutoPkg.</notes><priority>6</priority><reboot_required>False</reboot_required><required_processor>None</required_processor><os_requirements></os_requirements><hash_type>SHA_512</hash_type><hash_value>ee8a5ef2d12960f45f2024850fd71476d7c14bd784d887ded4a0119bd65aac3142780a9695cb0c5813062eebcd2c481ff300f8425ca5cdbbdd6e3c9fcd0bd925</hash_value><send_notification>False</send_notification></package>
JamfPackageUploader: Package metadata upload attempt 1
JamfPackageUploader: Existing cookie found: APBALANCEID=aws.euc1-std-ellison1-tc-15
JamfPackageUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://jamf.pro.server.here/JSSResource/packages/id/21 --request PUT --header authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMGRiNDg2NDMtMjBiZi00MjlhLWFkM2UtYmY2ZjA3MThhNWJkIiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiI0IiwiZXhwIjoxNjQ0MjQ1MTYwfQ.eDJNWhsqFTnWqS1CE_4HcKXkFHy-j_U0t4C2spTjKUs --upload-file /tmp/jamf_upload/jamf_upload_afa43600-1a55-464e-84d3-504ce94bb2a2.txt --header Content-type: application/xml --cookie APBALANCEID=aws.euc1-std-ellison1-tc-15
JamfPackageUploader: Package metadata 'Cisco_Umbrella_3.0.5.pkg' update successful
{'Output': {'jamfpackageuploader_summary_result': {'data': {'category': 'Apps',
                                                            'pkg_name': 'Cisco_Umbrella_3.0.5.pkg',
                                                            'pkg_path': '/Users/username/Library/AutoPkg/Cache/local.jamf.CiscoUmbrella/Cisco_Umbrella_3.0.5.pkg',
                                                            'version': '3.0.5'},
                                                   'report_fields': ['pkg_path',
                                                                     'pkg_name',
                                                                     'version',
                                                                     'category'],
                                                   'summary_text': 'The '
                                                                   'following '
                                                                   'packages '
                                                                   'were '
                                                                   'uploaded '
                                                                   'to or '
                                                                   'updated in '
                                                                   'Jamf Pro:'},
            'pkg_name': 'Cisco_Umbrella_3.0.5.pkg',
            'pkg_path': '/Users/username/Library/AutoPkg/Cache/local.jamf.CiscoUmbrella/Cisco_Umbrella_3.0.5.pkg',
            'pkg_uploaded': True}}
com.github.grahampugh.jamf-upload.processors/JamfUploaderSlacker
{'Input': {'JSS_URL': 'https://jamf.pro.server.here',
           'NAME': 'Cisco Umbrella',
           'jamfpackageuploader_summary_result': {'data': {'category': 'Apps',
                                                           'pkg_name': 'Cisco_Umbrella_3.0.5.pkg',
                                                           'pkg_path': '/Users/username/Library/AutoPkg/Cache/local.jamf.CiscoUmbrella/Cisco_Umbrella_3.0.5.pkg',
                                                           'version': '3.0.5'},
                                                  'report_fields': ['pkg_path',
                                                                    'pkg_name',
                                                                    'version',
                                                                    'category'],
                                                  'summary_text': 'The '
                                                                  'following '
                                                                  'packages '
                                                                  'were '
                                                                  'uploaded to '
                                                                  'or updated '
                                                                  'in Jamf '
                                                                  'Pro:'},
           'pkg_name': 'Cisco_Umbrella_3.0.5.pkg',
           'slack_webhook_url': 'https://hooks.slack.com/services/904324BF/178BF71E2FB4/80f35feb9d418b6897e3'}}
JamfUploaderSlacker: No value supplied for slack_username, setting default value of: AutoPkg
JamfUploaderSlacker: No value supplied for slack_icon_url, setting default value of: 
JamfUploaderSlacker: JSS address: https://jamf.pro.server.here
JamfUploaderSlacker: Title: Cisco Umbrella
JamfUploaderSlacker: Policy: None
JamfUploaderSlacker: Version: 3.0.5
JamfUploaderSlacker: Package: Cisco_Umbrella_3.0.5.pkg
JamfUploaderSlacker: Package Category: None
JamfUploaderSlacker: Policy Category: None
JamfUploaderSlacker: Slack webhook post attempt 1
JamfUploaderSlacker: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://hooks.slack.com/services/904324BF/178BF71E2FB4/80f35feb9d418b6897e3 --request POST --data {"text": "*New Item uploaded to Jamf Pro:*\nURL: https://jamf.pro.server.here\nVersion: *3.0.5*\nCategory: *None*\nPackage: *Cisco_Umbrella_3.0.5.pkg*", "username": "AutoPkg"} --header Content-type: application/json
JamfUploaderSlacker: Slack webhook sent successfully

Curl command being sent to Slack:

/usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://hooks.slack.com/services/904324BF/178BF71E2FB4/80f35feb9d418b6897e3 --request POST --data {"text": "*New Item uploaded to Jamf Pro:*\nURL: https://jamf.pro.server.here\nVersion: *3.0.5*\nCategory: *None*\nPackage: *Cisco_Umbrella_3.0.5.pkg*", "username": "AutoPkg"} --header Content-type: application/json

Full output from verbose AutoPkg run linked below:

https://gist.github.com/rtrouton/ba1a25b8fab2ac28d8664b7e372facb5

[Feature Request] JamfPatchUploader only update the definition (add/link the pkg), but not create a patch policy?

Is it possible to have JamfPatchUploader only update the definition (add/link the pkg), but not create a patch policy?
I can get it to work if I can create patch template xml file with an exclusion computer group, that doesnโ€™t exist and it will throw an error Error: Unable to match excluded computer group
Then I can use only one patch def named โ€œName Latestโ€ and then manually change Target Version when Iโ€™m ready with the testings.

Thanks!

<computer_groups>
<computer_group>
<name>If this value is set the if will fail and dont create a patchdefination</name>
</computer_group>
</computer_groups>
<users/>
<buildings/>
<departments/>
<network_segments/>
<ibeacons/>
</exclusions>

1
2

Test mode for JamfPackageCleaner?

As a feature request, It would be very nice to have a way to do a run with the JamfPackageCleaner post processor that will just print what would happen instead of actually doing the delete. I am tip toeing into a very large clean up with messy naming and itwould be nice to see just the report first of what would happen.

Jamf Uploader Feature request: Optionally disable XML escaping for template variable substitution

I would like the ability to disable XML escaping when an XML template has variable substitution performed in the Jamf Uploader processors, namely:

JamfAccountUploader
JamfMacAppUploader
JamfPatchUploader
JamfPolicyUploader
JamfSoftwareRestrictionUploader
My use case is to reduce the number of templates I need to maintain in our environment and move more flexibility into our AutoPkg recipe overrides, for example including 2 computer groups and corresponding XML tags directly in a single variable that is substituted into the template.

In my environment I try to re-use policy templates as much as possible, rather than creating one for each recipe override. We ended up needing several templates where the only differences were to do with scoping, in particular with a varying number of substitutions. For example, one template for where there were no exclusion computer groups, another where there was one, and another where there was two etc.

My solution to simplify was to effectively include multiple computer group names, along with their XML tags, in a single input variable. However jamf-upload was automatically escaping the xml inside the variable, preventing this solution. I put this code change together as a proof of concept and it served well.

As a side note, I then took it a step further and created a StringJoiner shared processor (com.github.davidbpirie.SharedProcessors/StringJoiner) that can be given list input variables and it joins the list values together with provided glue into a new single variable; if the list is empty, the result is an empty string (ie no leftover glue).

Obviously enabling this option in a recipe requires careful consideration by the author about what input variables are being substituted, and whether they contain characters that need to be escaped for XML.

I will submit a PR with my suggested implementation.

Use of undefined key in variable sostituito: 'version'

testing the run of any .jamf recipes it return me this error.

test@myMac ~ % autopkg run -v Firefox.jamf
Processing Firefox.jamf...
Use of undefined key in variable substitution: 'version'
Use of undefined key in variable substitution: 'version'

test@NiL-MBP-338 ~ % autopkg run -v GoogleChrome.jamf
Processing GoogleChrome.jamf...
Use of undefined key in variable substitution: 'version'
Use of undefined key in variable substitution: 'version'

curl outputs progress to stderr

When JamfUploader processes run, they execute curl commands in a default mode that outputs progress indicators to stderr. This generates a lot of false positive noise for anyone monitoring stderr for, well, errors. :) If the curl_cmd builder step in each script adds the --silent and --show-error arguments, that would keep the progress indicators from going to stderr (--silent) but still send error message results to stderr (--show-error), which would be helpful for AutoPkg workflows that monitor for and flag errors found during recipe runs.

Happy to put in a PR for this, but I first wanted to check whether this was a desirable change.

`jamf_api_tool.py` Errors

On a fresh install of โ€ฆ

  • macOS 11.6.1 (20G224) on Intel
  • git 2.30.1 (Apple Git-130)
  • autopkg 2.3.1

โ€ฆ with a local clone of jamf-upload, Iโ€™m observing the following errors:

% /usr/local/autopkg/python ~/Documents/GitHub/grahampugh/jamf-upload/jamf_api_tool.py --prefs ~/Library/Preferences/com.github.autopkg.plist --computers --all --verbose

** Jamf API Tool for Jamf Pro.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   379    0   379    0     0   2005      0 --:--:-- --:--:-- --:--:--  2005
Session token received
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   424  100   424    0     0   2409      0 --:--:-- --:--:-- --:--:--  2409
Traceback (most recent call last):
  File "/Users/ladmin/Documents/GitHub/grahampugh/jamf-upload/jamf_api_tool.py", line 1060, in <module>
    main()
  File "/Users/ladmin/Documents/GitHub/grahampugh/jamf-upload/jamf_api_tool.py", line 1026, in main
    handle_computers(jamf_url, enc_creds, args, slack_webhook, verbosity)
  File "/Users/ladmin/Documents/GitHub/grahampugh/jamf-upload/jamf_api_tool.py", line 52, in handle_computers
    for x in obj:
TypeError: 'NoneType' object is not iterable

JCDS mode: upload working, but policy can't find package

I updated to the latest version of jamfuploader and corrected local trust. However I'm having issues with jcds upload. API access rights are set as described with SSO read/update.

Package was removed from server as well as policy.

Here is the log of what happens:

Processing local.jamf.MicrosoftWord...
...
{'Output': {}}
com.github.grahampugh.jamf-upload.processors/JamfPackageUploader
{'Input': {'API_PASSWORD': 'xxxx',
           'API_USERNAME': 'xxx',
           'JSS_URL': 'https://xxx.jamfcloud.com',
           'jcds_mode': 'True',
           'pkg_category': '#SW - Basics',
           'pkg_path': '/Users/autopkg/Library/AutoPkg/Cache/local.jamf.MicrosoftWord/MicrosoftWord-UNI-16.72.pkg',
           'version': '16.72'}}
JamfPackageUploader: No value supplied for pkg_name, setting default value of: 
JamfPackageUploader: No value supplied for pkg_info, setting default value of: 
JamfPackageUploader: No value supplied for pkg_notes, setting default value of: 
JamfPackageUploader: No value supplied for pkg_priority, setting default value of: 10
JamfPackageUploader: No value supplied for reboot_required, setting default value of: 
JamfPackageUploader: No value supplied for os_requirements, setting default value of: 
JamfPackageUploader: No value supplied for required_processor, setting default value of: None
JamfPackageUploader: No value supplied for send_notification, setting default value of: 
JamfPackageUploader: No value supplied for replace_pkg, setting default value of: False
JamfPackageUploader: No value supplied for replace_pkg_metadata, setting default value of: False
JamfPackageUploader: No value supplied for skip_metadata_upload, setting default value of: False
JamfPackageUploader: No value supplied for CLOUD_DP, setting default value of: False
JamfPackageUploader: No value supplied for SMB_URL, setting default value of: 
JamfPackageUploader: No value supplied for SMB_USERNAME, setting default value of: 
JamfPackageUploader: No value supplied for SMB_PASSWORD, setting default value of: 
JamfPackageUploader: No value supplied for sleep, setting default value of: 0
JamfPackageUploader: Checking for existing package 'MicrosoftWord-UNI-16.72.pkg' on https://ing.jamfcloud.com
JamfPackageUploader: Checking for existing authentication token
JamfPackageUploader: No existing valid token found
JamfPackageUploader: Getting an authentication token
JamfPackageUploader: No existing cookie found - starting new session
JamfPackageUploader: Session token received
JamfPackageUploader: Token: eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMWIwOGYwNDQtM2FhNS00ZTM0LWI2ZmMtMDY2N2RhN2RlYmFmIiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIyMiIsImV4cCI6MTY4MjUyMjE2M30.8EzGO9on7oPA8islt9W25PULoIRxOcUSxwE29a9BOY4
JamfPackageUploader: Expires: 2023-04-26T15:16:03.439Z
JamfPackageUploader: Jamf Pro Version: 10.45.0-t1678116779
JamfPackageUploader: Token auth will be used
JamfPackageUploader: Package 'MicrosoftWord-UNI-16.72.pkg' not found on server
JamfPackageUploader: Number of File Share DPs: 0
JamfPackageUploader: Handling Cloud Distribution Point
JamfPackageUploader: Uploading package using experimental JCDS mode
JamfPackageUploader: Checking for existing '#SW - Basics' on https://xxx.jamfcloud.com
JamfPackageUploader: ID for category #SW - Basics: 8
JamfPackageUploader: Failover URL obtained: https://xxx.jamfcloud.com/?failover=XXXXXXXXXXXXX
JamfPackageUploader: HTTP response: 200
JamfPackageUploader: Headers: ['HTTP/2 302', 'date: Wed, 26 Apr 2023 14:46:04 GMT', 'content-type: text/html;charset=utf-8', 'content-length: 0', 'set-cookie: AWSALB=jWIOn8t3R2e6tr7V1isYwLwJ97ixoLEgzQROtWT75Oqca9b+iycOOVDUit6VMtofWmek1FEZAPy0ap1E29UBo4t0dqS+vSNeTA+SHXbT/EJlWlUuPBLgkpe5T2hv; Expires=Wed, 03 May 2023 14:46:03 GMT; Path=/', 'set-cookie: AWSALBCORS=jWIOn8t3R2e6tr7V1isYwLwJ97ixoLEgzQROtWT75Oqca9b+iycOOVDUit6VMtofWmek1FEZAPy0ap1E29UBo4t0dqS+vSNeTA+SHXbT/EJlWlUuPBLgkpe5T2hv; Expires=Wed, 03 May 2023 14:46:03 GMT; Path=/; SameSite=None; Secure', 'x-frame-options: SAMEORIGIN', 'cache-control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0', 'strict-transport-security: max-age=31536000;includeSubDomains', 'x-xss-protection: 1; mode=block', 'cache-control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0', 'set-cookie: JSESSIONID=ODllYWE3YzktNzkyMi00OWE1LWI0ZDgtZDZmNDBjYmJjY2Nl; Path=/; Secure; HttpOnly; SameSite=Lax', 'location: /?failover=Xw30Mw6iQACWhIk9', 'server: Jamf Cloud Node', '', 'HTTP/2 200', 'date: Wed, 26 Apr 2023 14:46:04 GMT', 'content-type: text/html;charset=utf-8', 'set-cookie: AWSALB=whBtDVupgABwlUuxuXdVOCchnbx7WYTyQqzO+Lm/42v6qzsQuic5A7MoLsfBdx7LC/c8rPkNZc4wnfSI9P5puehBA6MbfIxEGKlnv7kgGKUw2ASOjOh2pDIPKeGK; Expires=Wed, 03 May 2023 14:46:04 GMT; Path=/', 'set-cookie: AWSALBCORS=whBtDVupgABwlUuxuXdVOCchnbx7WYTyQqzO+Lm/42v6qzsQuic5A7MoLsfBdx7LC/c8rPkNZc4wnfSI9P5puehBA6MbfIxEGKlnv7kgGKUw2ASOjOh2pDIPKeGK; Expires=Wed, 03 May 2023 14:46:04 GMT; Path=/; SameSite=None; Secure', 'x-frame-options: SAMEORIGIN', 'cache-control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0', 'strict-transport-security: max-age=31536000;includeSubDomains', 'x-xss-protection: 1; mode=block', 'cache-control: no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0', 'server: Jamf Cloud Node', '']
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 72525    0 72525    0     0   367k      0 --:--:-- --:--:-- --:--:--  389k
JamfPackageUploader: HTTP response: 200
JamfPackageUploader: Session Token: sd9ZGQQuPZowzXH9Zb093E1QQCCGUsyD
JamfPackageUploader: X-Auth Token: d9379492de864fbfa412f2c8f2a73ec6tf25s7jr3m68ddc46xtdmoufcg1n7gdu
JamfPackageUploader: Pkg Upload URL: https://euc1-jcds.services.jamfcloud.com/api/file/v2/d67c42d9f2d04ded8370873742cc700f/
JamfPackageUploader: Pkg Upload URL: https://euc1-jcds.services.jamfcloud.com/api/file/v2/d67c42d9f2d04ded8370873742cc700f//MicrosoftWord-UNI-16.72.pkg
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1154M    0   389  100 1154M      8  25.8M  0:00:44  0:00:44 --:--:-- 22.9M
JamfPackageUploader: HTTP response: 201
JamfPackageUploader: Pkg Object URL: https://xxx.jamfcloud.com/?failover=Xw30Mw6iQACWhIk9/legacy/packages.html?id=-1&o=c
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4635  100  4287  100   348  20981   1703 --:--:-- --:--:-- --:--:-- 24523
JamfPackageUploader: HTTP response: 200
{'Output': {'jamfpackageuploader_summary_result': {'data': {'category': '#SW - '
                                                                        'Basics',
                                                            'name': 'MicrosoftWord',
                                                            'pkg_name': 'MicrosoftWord-UNI-16.72.pkg',
                                                            'pkg_path': '/Users/autopkg/Library/AutoPkg/Cache/local.jamf.MicrosoftWord/MicrosoftWord-UNI-16.72.pkg',
                                                            'version': '16.72'},
                                                   'report_fields': ['category',
                                                                     'name',
                                                                     'pkg_name',
                                                                     'pkg_path',
                                                                     'version'],
                                                   'summary_text': 'The '
                                                                   'following '
                                                                   'packages '
                                                                   'were '
                                                                   'uploaded '
                                                                   'to or '
                                                                   'updated in '
                                                                   'Jamf Pro:'},
            'pkg_name': 'MicrosoftWord-UNI-16.72.pkg',
            'pkg_path': '/Users/autopkg/Library/AutoPkg/Cache/local.jamf.MicrosoftWord/MicrosoftWord-UNI-16.72.pkg',
            'pkg_uploaded': True}}
com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
{'Input': {'API_PASSWORD': 'xxx',
           'API_USERNAME': 'xxxx',
           'JSS_URL': 'https://xxx.jamfcloud.com',
           'icon': 'MicrosoftWord.png',
           'policy_name': 'SelfService-GL-InstallMicrosoftWord-UNI',
           'policy_template': 'JamfSelfServicePolicyTemplateAdditonalPKG.xml',
           'replace_policy': 'True',
           'sleep': '0'}}
JamfPolicyUploader: No value supplied for replace_icon, setting default value of: False
JamfPolicyUploader: Parent Recipe: /Users/autopkg/Library/AutoPkg/RecipeRepos/com.github.ing-bank.wps-osx-autopkg/Microsoft/MicrosoftWord.jamf.recipe
JamfPolicyUploader: File found at: /Users/autopkg/Library/AutoPkg/RecipeRepos/com.github.ing-bank.wps-osx-autopkg/JamfSelfServicePolicyTemplateAdditonalPKG.xml
JamfPolicyUploader: ("Replacing any instances of 'POLICY_NAME' with", "'SelfService-GL-InstallMicrosoftWord-UNI'")
JamfPolicyUploader: ("Replacing any instances of 'ALL_COMPUTERS' with", "'true'")
JamfPolicyUploader: ("Replacing any instances of 'GROUP_NAME' with", "'All Managed Clients'")
JamfPolicyUploader: ("Replacing any instances of 'pkg_name' with", "'MicrosoftWord-UNI-16.72.pkg'")
JamfPolicyUploader: ("Replacing any instances of 'SOFTWAREPKG2' with", "'OfficeTemplates-3.0.pkg'")
JamfPolicyUploader: ("Replacing any instances of 'SELF_SERVICE_DISPLAY_NAME' with", "'%FRIENDLYNAME% - %version%'")
JamfPolicyUploader: ("Replacing any instances of 'SELF_SERVICE_DESCRIPTION' with", "'Microsoft Word is a widely used commercial word processor designed by Microsoft and a component of the Microsoft Office suite of productivity software.'")
JamfPolicyUploader: ("Replacing any instances of 'SELF_SERVICE_FEATURE_MAINPAGE' with", "'false'")
JamfPolicyUploader: ("Replacing any instances of 'SELFSERVICE_CATEGORY' with", "'Office'")
JamfPolicyUploader: ("Replacing any instances of 'FRIENDLYNAME' with", "'Microsoft Word'")
JamfPolicyUploader: ("Replacing any instances of 'version' with", "'16.72'")
JamfPolicyUploader: Policy data:
JamfPolicyUploader: <policy>
     <!-- General - Name, Enabled/Disabled, Triggers, Frequency, Categories -->
     <general>
          <name>SelfService-GL-InstallMicrosoftWord-UNI</name>
          <enabled>true</enabled>
          <frequency>Ongoing</frequency>
     </general>
     <!-- Scope -->
     <scope>
          <all_computers>true</all_computers>
          <computer_groups>
               <computer_group>
                    <name>All Managed Clients</name>
               </computer_group>
          </computer_groups>
          <exclusions/>
     </scope>
     <!-- Packages -->
     <package_configuration>
          <packages>
               <size>2</size>
               <package>
                    <name>MicrosoftWord-UNI-16.72.pkg</name>
                    <action>Install</action>
               </package>
               <package>
                    <name>OfficeTemplates-3.0.pkg</name>
                    <action>Install</action>
               </package>
          </packages>
     </package_configuration>
     <!-- Scripts -->
     <scripts>
          <size>0</size>
     </scripts>
     <!-- Self Service details -->
     <self_service>
          <use_for_self_service>true</use_for_self_service>
          <self_service_display_name>Microsoft Word - 16.72</self_service_display_name>
          <install_button_text>Install</install_button_text>
          <reinstall_button_text>Reinstall</reinstall_button_text>
          <self_service_description>Microsoft Word is a widely used commercial word processor designed by Microsoft and a component of the Microsoft Office suite of productivity software.</self_service_description>
          <feature_on_main_page>false</feature_on_main_page>
          <self_service_categories>
               <category>
                    <name>Office</name>
                    <display_in>true</display_in>
                    <feature_in>false</feature_in>
               </category>
          </self_service_categories>
     </self_service>
     <!-- Maintenance e.g. recon -->
     <maintenance>
          <recon>true</recon>
     </maintenance>
     <!-- Files and processes e.g. run command -->
     <files_processes/>
     <!-- User interaction e.g. start and finish messages -->
     <user_interaction>
          <message_start/>
          <message_finish/>
     </user_interaction>
</policy>

JamfPolicyUploader: Checking for existing 'SelfService-GL-InstallMicrosoftWord-UNI' on https://xxx.jamfcloud.com
JamfPolicyUploader: Checking for existing authentication token
JamfPolicyUploader: No existing valid token found
JamfPolicyUploader: Getting an authentication token
JamfPolicyUploader: Session token received
JamfPolicyUploader: Token: eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiNTM2Zjc4NzAtZGNjNC00ZWRiLWI0MzktYTZlY2E2N2E0MWI3IiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIyMiIsImV4cCI6MTY4MjUyMjIwOX0.OAosUH4dLwwK3w7qMADTEMTbCNGBg_t6YmNgjkmEgag
JamfPolicyUploader: Expires: 2023-04-26T15:16:49.266Z
JamfPolicyUploader: Jamf Pro Version: 10.45.0-t1678116779
JamfPolicyUploader: Token auth will be used
JamfPolicyUploader: Uploading Policy...
JamfPolicyUploader: Policy upload attempt 1
JamfPolicyUploader: API Error: Problem with package
WARNING: Policy 'SelfService-GL-InstallMicrosoftWord-UNI' upload failed due to the following conflict: Problem with package
Failed.
Receipt written to /Users/autopkg/Library/AutoPkg/Cache/local.jamf.MicrosoftWord/receipts/local.jamf-receipt-20230426-164649.plist

The following recipes failed:
    local.jamf.MicrosoftWord
        Error in local.jamf.MicrosoftWord: Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader: Error: WARNING: Policy 'SelfService-GL-InstallMicrosoftWord-UNI' upload failed due to the following conflict: Problem with package

The following new items were downloaded:
    Download Path                                                                              
    -------------                                                                              
    /Users/autopkg/Library/AutoPkg/Cache/local.jamf.MicrosoftWord/downloads/MicrosoftWord.pkg  

The following packages were copied:
    Pkg Path                                                                                   
    --------                                                                                   
    /Users/autopkg/Library/AutoPkg/Cache/local.jamf.MicrosoftWord/MicrosoftWord-UNI-16.72.pkg  

The following packages were uploaded to or updated in Jamf Pro:
    Category      Name           Pkg Name                     Pkg Path                                                                                   Version  
    --------      ----           --------                     --------                                                                                   -------  
    #SW - Basics  MicrosoftWord  MicrosoftWord-UNI-16.72.pkg  /Users/autopkg/Library/AutoPkg/Cache/local.jamf.MicrosoftWord/MicrosoftWord-UNI-16.72.pkg  16.72 

I replaced Username, Password and URL and failover URL with XXX

Links Under Example Recipes Broken

The links that are under the Example Recipes section of the "JamfUploader AutoPkg Processors" section of the wiki are broken. They all lead to a Page not Found GitHub page.

[Errno 1] Operation not permitted: '/Volumes/jamf/Packages/ApE-3.1.2.pkg'

I don't know exactly when this changed but JamfPackageUploader quit working for me a while ago and I'm finally getting around to figuring it out. It's because of macOS Mandatory Access Controls. I've discovered you can tell when it's MAC vs Unix permissions by the exact error. Permission denied is Unix permissions. "Operation not permitted" is MAC. It turned out this was affecting me because I was running autopkg over ssh and, as I said earlier, I don't know when it changed but "sshd-keygen-wrapper" quit being selected by default in "Full Disk Access" in the Security & Privacy pref pane. I'm using ssh because this is being run as part of a CI/CD workflow (using Tart).

I guess I'm filing this issue to suggest better error reporting. This is the error right now.

JamfPackageUploader: Copying ApE-3.1.2.pkg to /Volumes/jamf/Packages/ApE-3.1.2.pkg
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/admin/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPackageUploader.py", line 738, in main
    self.copy_pkg(self.smb_url, self.pkg_path, self.pkg_name)
  File "/Users/admin/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPackageUploader.py", line 264, in copy_pkg
    copyfile(pkg_path, destination_pkg_path)
  File "/Library/AutoPkg/Python3/Python.framework/Versions/3.10/lib/python3.10/shutil.py", line 256, in copyfile
    with open(dst, 'wb') as fdst:
PermissionError: [Errno 1] Operation not permitted: '/Volumes/jamf/Packages/ApE-3.1.2.pkg'
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
[Errno 1] Operation not permitted: '/Volumes/jamf/Packages/ApE-3.1.2.pkg'

I'd check for this error and print out that it's probably MAC and tell the user to check System Prefs, Security & Privacy.

I'm glad to have this working again.

Feature Request: Allow uploading .zip files

Jamf distribution points are capable of accepting .zip files that contain a .pkg (and optionally other config files). The Jamf agent will then unzip the file and run the pkg installer contained within. This is useful when certain installers require some configuration file or other data to be present in the same directory during installation.

I am requesting that JamfPackageUploader support this workflow, if possible.

JamfPatchUploader bug if an incorrect patch_icon_policy_name is supplied.

See lines 383-386:

                self.output(
                    f"No policy with the given name '{self.patch_icon_policy_name}' was found.",
                    "Not able to extract an icon. Continuing...",
                )

Should be this I guess:

                self.output(
                    (
                        f"No policy with the given name '{self.patch_icon_policy_name}' was found."
                        "Not able to extract an icon. Continuing..."
                    )
                )

'JamfPackageUploader' object has no attribute 'smb_shares'

I'm not using SMB shares and hence have no SMB_* variables in my autopkg config. Today after updating jamf-upload repository I started getting these kind of errors upon running any recipe with JamfPackageUploader processor.

The following recipes failed:
    overrides/zoom-override.jamf.recipe.yaml
        Error in local.jamf.zoom-override: Processor: com.github.grahampugh.jamf-upload.processors/JamfPackageUploader: Error: 'JamfPackageUploader' object has no attribute 'smb_shares'

This simple fix alleviates that:


--- JamfPackageUploader.py.old	2022-10-14 10:09:35.000000000 +0300
+++ JamfPackageUploader.py	2022-10-14 10:10:06.000000000 +0300
@@ -673,6 +673,7 @@
         self.pkg_metadata_updated = False

         # Create a list of smb shares in tuples
+        self.smb_shares = []
         if self.env.get("SMB_URL"):
             if not self.env.get("SMB_USERNAME") or not self.env.get("SMB_PASSWORD"):
                 raise ProcessorError("SMB_URL defined but no credentials supplied.")

Update jamf-upload.sh to be platform agnostic

After experimenting with the standalone_uploaders scripts via GitHub Actions on Ubuntu runners, it would be great to shift over to the jamf-upload.sh script instead which has a broader coverage of managing a Jamf Pro instance.

Other than importing autopkglib on linux, the script would also need to be updated with alternatives for plutil, PlistBuddy, and hardcoded paths to where AutoPkg is normally installed.

Feature request: Alternative version string input for JamfPatchUploader

I think what I need is JamfPatchUploader to have an optional input for an alternative version string to match against the string Jamf has for the definition of any give pkg version.

The issue I'm looking to solve:
The Jamf patch entry for Zoom is looking for version numbers like 5.14.10 (19202), which is ugly but none the less what they have.

The zoom autopkg recipe I found formats in a sane way: 5.14.10.19202

If I try to use JamfPatchUploader to add the pkg to the patch definition, the mismatch returns this error:
Error in local.jamf-patch.Zoom: Processor: com.github.grahampugh.jamf-upload.processors/JamfPatchUploader: Error: ERROR: Could not find matching version '5.14.10.19202' in patch softwaretitle 'Zoom'. Latest reported version is '5.14.10 (19202)'.

The zoom recipe does grab the version string from the Info.plist that matches what Jamf has but doesn't use it and I'm not sure I see a way to get an override to use that correctly and regardless, the only place it's goofy is where Jamf defines the version string.

So....if JamfPatchUploader had an optional input for version string that it uses to match what Jamf has for the version instead of the regular %VERSION% variable that's passed from further up the chain, that would allow a match.

Please forgive me if I'm missing an obvious existing solution for this. Thanks!

WARNING: Could not read HTTP response. The package was probably not uploaded successfully

I apologize if this is the wrong place to put this, but I have not been able to find any other sources of assistance.

Trying to use JamfPackageUploader and getting this:

WARNING: Could not read HTTP response. The package was probably not uploaded successfully

Attempting to migrate from JSSImporter. Using the same API_USERNAME, API_PASSWORD, and JSS_URL that was working successfully on JSSImporter.

This is the command I am trying:

autopkg run visualstudiocode.pkg --post com.github.grahampugh.jamf-upload.processors/JamfPackageUploader

It doesn't seem to matter what I put in for the API_USERNAME or API_PASSWORD (I've tried valid users/passwords and invalid ones to attempt to get a different error) but the result is always the same.

I have also set up the JAMF user as directed, but gave it full admin rights to see if that would change anything but it did not.

Output from the JamfPackageUploader portion of the -vvv output below:

com.github.grahampugh.jamf-upload.processors/JamfPackageUploader
{'Input': {'API_PASSWORD': 'password',
           'API_USERNAME': 'username',
           'JSS_URL': 'https://mydomain.jamfcloud.com:8443',
           'pkg_path': '/Users/autopkg/Library/AutoPkg/Cache/local.pkg.visualstudiocode/Visual '
                       'Studio Code-1.65.2.pkg',
           'version': '1.65.2'}}
JamfPackageUploader: No value supplied for pkg_name, setting default value of:
JamfPackageUploader: No value supplied for pkg_category, setting default value of:
JamfPackageUploader: No value supplied for pkg_info, setting default value of:
JamfPackageUploader: No value supplied for pkg_notes, setting default value of:
JamfPackageUploader: No value supplied for pkg_priority, setting default value of: 10
JamfPackageUploader: No value supplied for reboot_required, setting default value of:
JamfPackageUploader: No value supplied for os_requirements, setting default value of:
JamfPackageUploader: No value supplied for required_processor, setting default value of: None
JamfPackageUploader: No value supplied for send_notification, setting default value of:
JamfPackageUploader: No value supplied for replace_pkg, setting default value of: False
JamfPackageUploader: No value supplied for replace_pkg_metadata, setting default value of: False
JamfPackageUploader: No value supplied for SMB_URL, setting default value of:
JamfPackageUploader: No value supplied for SMB_USERNAME, setting default value of:
JamfPackageUploader: No value supplied for SMB_PASSWORD, setting default value of:
JamfPackageUploader: Checking for existing 'Visual Studio Code-1.65.2.pkg' on https://mydomain.jamfcloud.com:8443
JamfPackageUploader: Checking for existing authentication token
JamfPackageUploader: No existing valid token found
JamfPackageUploader: Getting an authentication token
JamfPackageUploader: Existing cookie found: APBALANCEID=aws.usw2-std-parker2-tc-9
JamfPackageUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://mydomain.jamfcloud.com:8443/api/v1/auth/token --request POST --header authorization: Basic redacted --header Content-type: application/json --cookie APBALANCEID=aws.usw2-std-parker2-tc-9
JamfPackageUploader: ERROR: No token received
JamfPackageUploader: No token found, basic auth will be used,
JamfPackageUploader: Existing cookie found: APBALANCEID=aws.usw2-std-parker2-tc-9
JamfPackageUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://mydomain.jamfcloud.com:8443/JSSResource/packages/name/Visual%20Studio%20Code-1.65.2.pkg --request GET --header authorization: Basic redacted --header Accept: application/json --cookie APBALANCEID=aws.usw2-std-parker2-tc-9
JamfPackageUploader: ID: -1
JamfPackageUploader: Existing cookie found: APBALANCEID=aws.usw2-std-parker2-tc-9
JamfPackageUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://mydomain.jamfcloud.com:8443/dbfileupload --request POST --header authorization: Basic redacted --upload-file /Users/autopkg/Library/AutoPkg/Cache/local.pkg.visualstudiocode/Visual Studio Code-1.65.2.pkg --header Accept: application/xml --cookie APBALANCEID=aws.usw2-std-parker2-tc-9 --header DESTINATION: 0 --header OBJECT_ID: -1 --header FILE_TYPE: 0 --header FILE_NAME: Visual Studio Code-1.65.2.pkg --max-time 3600
JamfPackageUploader: HTTP response: 502
JamfPackageUploader: Could not parse XML. Raw output:
JamfPackageUploader: <!DOCTYPE html>
<!--
??????????????MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
I?????????????MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN8M
I????????????IMMMM??I????IMMMMMMMMMMNOOOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOOOOM
I????????????MMD??????????MMMMMMMMMMNOOOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOOOMMM
I????????????MMI??????????MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM8OOMMMM
I???????????DMI???????????MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM8OOMMMM
I?????????IMMM????????????MMMMMMMMMMMOO8MMMMMM8OOOOOOODMMMMMMMMMOOMMOOOOODMMM8OOOOO8MMMMMMMOOOOOOOOM
M$$$$$$ZNMMMM?????????????MMMMMMMMMMMOO8MMMMMNOOOO8OOOOOOMMMMMMMOOOOOOOOOOOMOOOOOOOOO8MMMMMOOOOOOOOM
MMMMMMMMMMMMNI????????????MMMMMMMMMMMOO8MMMMMMMMMMMMMMDOO8MMMMMMOOOMMMMMMOOOONMMMMMOOOMMMMMMM8OOMMMM
MMMMMMMMMMMMI?????????????MMMMMMMMMMMOO8MMMMMMMMMMMMMMMOOOMMMMMMOONMMMMMMMOODMMMMMMMOONMMMMMM8OOMMMM
MMMMMMMMMMM7??????????????MMMMMMMMMMMOO8MMMMMNOOOOOOOO8OOOMMMMMMOOMMMMMMMMOOMMMMMMMMOODMMMMMM8OOMMMM
MMMMMMMMMOI???????????????MMMMMMMMMMMOO8MMMMOOO8MMMMMMOOOOMMMMMMOOMMMMMMMMOOMMMMMMMMOODMMMMMM8OOMMMM
I?????????????????????????MMMMMMMMMMMOO8MMMNOODMMMMMMMMOOOMMMMMMOOMMMMMMMMOOMMMMMMMMOODMMMMMM8OOMMMM
I?????????????????????????MMMMMMMMMMMOO8MMMNOONMMMMMMMMOOOMMMMMMOOMMMMMMMMOOMMMMMMMMOODMMMMMM8OOMMMM
I?????????????????????????MMMMMMMMMMMOO8MMMMOOONMMMMMM8OOOMMMMMMOOMMMMMMMMOOMMMMMMMMOODMMMMMM8OOMMMM
D????????????III???????II$MMMMMMMMMMMOO8MMMMM88OOOOOOO88OOMMMMMMOOMMMMMMMMOOMMMMMMMMOODMMMMMM8OOMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOOOMMMMMMMMD888MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOOOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOO8MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNDOOOOMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMOOOO8MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
-->
<html>
    <head>
        <link rel="icon" sizes="192x192" href='https://www.jamf.com/touch-icon-192x192.png'>
        <link rel="apple-touch-icon-precomposed" sizes="180x180" href='https://www.jamf.com/apple-touch-icon-180x180.png'>
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href='https://www.jamf.com/apple-touch-icon-152x152.png'>
        <link rel="apple-touch-icon-precomposed" sizes="144x144" href='https://www.jamf.com/apple-touch-icon-144x144.png'>
        <link rel="apple-touch-icon-precomposed" sizes="120x120" href='https://www.jamf.com/apple-touch-icon-120x120.png'>
        <link rel="apple-touch-icon-precomposed" sizes="114x114" href='https://www.jamf.com/apple-touch-icon-114x114.png'>
        <link rel="apple-touch-icon-precomposed" sizes="76x76" href='https://www.jamf.com/apple-touch-icon-76x76.png'>
        <link rel="apple-touch-icon-precomposed" sizes="72x72" href='https://www.jamf.com/apple-touch-icon-72x72.png'>
        <link rel="apple-touch-icon-precomposed" href='https://www.jamf.com/apple-touch-icon.png'>
        <link rel="shortcut icon" href='https://www.jamf.com/favicon.ico' type="image/x-icon">
        <link rel="icon" href='https://www.jamf.com/favicon.ico' type="image/x-icon">
        <link rel="mask-icon" href='https://www.jamf.com/pin-mask.svg' color="#5b6983">

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

        <link rel="stylesheet" type="text/css" href="https://www.jamf.com/jamf-nation/css/jamfnation.min.css"/>

        <title>Jamf Cloud - Timeout</title>
</head>
<body>
    <header class="jamf-nav--fixed headroom headroom--top headroom--not-bottom" data-headroom="" data-offset="70">
        <div class="jamf-nav__bar jamf-nav__bar--global">
            <div class="jamf-nav__bar-content">
                <div class="jamf-nav__links" role="tablist">
                    <a class="jamf-nav__link" href="https://www.jamf.com/" data-analytics-title="Home">
                        <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 162 56" class="brand__logo">
                            <title>Jamf</title>
                            <path class="logo__River" fill="#778eb1" d="M33.6,7 C28.1,7 24.8,9.3 23.3,14.3 L19.5,26.2 C18.1,30.1 15.8,31.7 11.7,31.7 L2.2,31.7 C1,31.7 0,32.7 0,33.9 L0,40 C0,41.1 0.9,42 2.1,42 L40.7,42 C41.9,42 42.9,41 42.9,39.8 L42.9,9.1 C42.9,7.9 42,7 40.8,7 L33.6,7 L33.6,7 Z M2.3,0 C1.1,0 0,1.1 0,2.3 L0,18.5 C0,19.8 1,20.8 2.3,20.8 L10.5,20.8 C14.2,20.8 19.4,20 20.8,13.4 C20.8,13.4 22.2,6.7 23,2.8 C23.3,1.3 22.2,-7.10542736e-15 20.7,-7.10542736e-15 L2.3,-7.10542736e-15 L2.3,0 Z"></path>
                            <path class="logo__wordmark" fill="#fff" d="M152.9,13.3 C152.9,7.8 156.6,5.2 161.8,5 L161.8,9.5 L160.9,9.5 C158.6,9.5 157.4,11.4 157.4,13.7 L157.4,17.3 L161.6,17.3 L161.6,21.3 L157.4,21.3 L157.4,43.5 L152.9,43.5 L152.9,21.2 L149,21.2 L149,17.2 L152.9,17.2 L152.9,13.3 L152.9,13.3 Z M137.3,27.7 C137.3,23.2 134.7,21.2 131.6,21.2 C127.9,21.2 125.1,23.6 125.1,27.9 L125.1,43.7 L120.6,43.7 L120.6,27.7 C120.6,23.2 118,21.2 114.9,21.2 C111.2,21.2 108.4,23.6 108.4,27.9 L108.4,43.7 L104,43.7 L104,17.6 L108.5,17.6 L108.5,20.7 L108.6,20.7 C109.8,18 113,17 115.7,17 C118.3,17 121.2,17.7 123.3,21.5 C124.9,18.2 128.3,17 131.7,17 C137.3,17 141.6,20.4 141.6,27.2 L141.6,43.7 L137.1,43.7 L137.1,27.7 L137.3,27.7 Z M83.1,29.9 C77.6,29.9 75.8,32.6 75.8,35.1 C75.8,37.6 77.6,40.3 83.1,40.3 C88.6,40.3 90.4,37.6 90.4,35.1 C90.4,32.6 88.5,29.9 83.1,29.9 L83.1,29.9 L83.1,29.9 Z M90.2,26.2 C90.2,21.9 85.9,20.9 82.5,20.9 C80.1,20.9 77.8,21.5 75.4,22.7 L73.4,19 C77.3,17.3 80.4,17 82.7,17 C88.9,17 94.7,19.7 94.7,25.9 L94.7,43.7 L90.5,43.7 L90.5,40.9 C88.2,43.3 85.7,44.3 82.3,44.3 C76,44.3 71,40.8 71,34.9 C71,30.1 75,25.9 82.2,25.9 C84.9,25.9 87.8,26.7 90.2,28.9 L90.2,26.2 L90.2,26.2 Z M62.5,6 C64.2,6 65.6,7.4 65.6,9.1 C65.6,10.9 64.2,12.3 62.5,12.3 C60.8,12.3 59.4,10.9 59.4,9.2 C59.4,7.4 60.8,6 62.5,6 L62.5,6 L62.5,6 Z M60.4,17.4 L64.9,17.4 L65,46.9 C65,53.7 60.6,56 55.7,56 L54,56 L54,51.8 L55.7,51.8 C60.1,51.8 60.5,49.4 60.5,47.1 L60.4,17.4 L60.4,17.4 Z"></path>
                        </svg>
                    </a>
                </div>
            </div>
        </div>
    </header>
    <div id="page-content" style="margin-top: 69px">
        <div class="container-fluid">
            <div class="row">
                <div class="col-sm-12">
                    <div class="well">
                        <h2>This Service is Temporarily Unavailable</h2>
                        <p>Please excuse the inconvenience. It appears your request has timed out. Please try again shortly.</p>
                        <p>Please contact us if you need immediate assistance or would like more information.</p>
                    </div>
                    <div class="well">
                        <h4>Technical Support</h4>
                        <p>
                            <p>
                            <span class="col-xs-2">United States</span>
                                <a href="tel:+6122161296">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> (612) 216-1296</a>
                            </p>
                            <p>
                            <span class="col-xs-2">Australia</span>
                                <a href="tel:+610280152224">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> +61 02 80 15 22 24</a>
                            </p>
                            <p>
                            <span class="col-xs-2">Hong Kong</span>
                                <a href="tel:+85258084970">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> +852 5808 4970</a>
                            </p>
                            <p>
                                <span class="col-xs-2">United Kingdom</span>
                                <a href="tel:+442030147479">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> +44 20 30 14 74 79</a>
                            </p>
                            <p>
                                <span class="col-xs-2">France</span>
                                <a href="tel:+33184886656">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> +33 1 84 88 66 56</a>
                            </p>
                            <p>
                                <span class="col-xs-2">Germany</span>
                                <a href="tel:+496996759737">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> +49 69 96 75 97 37</a>
                            </p>
                            <p>
                                <span class="col-xs-2">Netherlands</span>
                                <a href="tel:+31202410671">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> +31 20 241 06 71</a>
                            </p>
                            <p>
                                <span class="col-xs-2">Japan</span>
                                <a href="tel:+81345406654">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> +81 345406654</a>
                            </p>
                            <p>
                                <span class="col-xs-2">China</span>
                                <a href="tel:4008907842">
                                <i class="jcon-answer" role="presentation" aria-hidden="true"></i> 400-890-7842</a>
                            </p>
                            <p>
                                <span class="col-xs-2">Email</span>
                                <a href="mailto:[email protected]">
                                <i class="jcon-paper-plane-2" role="presentation" aria-hidden="true"></i> [email protected]</a>
                            </p>
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

Traceback (most recent call last):
  File "/Users/autopkg/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPackageUploader.py", line 546, in main
    pkg_id = ElementTree.fromstring(r.output).findtext("id")
  File "/Library/AutoPkg/Python3/Python.framework/Versions/Current/lib/python3.7/xml/etree/ElementTree.py", line 1315, in XML
    parser.feed(text)
  File "<string>", line None
xml.etree.ElementTree.ParseError: mismatched tag: line 47, column 2

During handling of the above exception, another exception occurred:

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/autopkg/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPackageUploader.py", line 562, in main
    "WARNING: Could not read HTTP response. The package was probably not "
autopkglib.ProcessorError: WARNING: Could not read HTTP response. The package was probably not uploaded successfully
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
WARNING: Could not read HTTP response. The package was probably not uploaded successfully
Failed.
Receipt written to /Users/autopkg/Library/AutoPkg/Cache/local.pkg.visualstudiocode/receipts/visualstudiocode-receipt-20220310-145503.plist

The following recipes failed:
    visualstudiocode.pkg
        Error in local.pkg.visualstudiocode: Processor: com.github.grahampugh.jamf-upload.processors/JamfPackageUploader: Error: WARNING: Could not read HTTP response. The package was probably not uploaded successfully

Nothing downloaded, packaged or imported.

Thanks!

Write package metadata to package object

It would be advantageous if package metadata such as category could be added to the package object.

This has some difficulties with the current Jamf API, since (as far as I know) it requires multiple requests to achieve, and there is no reliable feedback that the first POST request to upload the package was successful, in order to get the object id with which to PUT the other metadata to the object.

jamf-upload processor not handling return codes...

So I am seeing mixed messages in a verbose run of the jamf-upload processor. Here is the confusing output:

JamfPackageUploader: HTTP response: <property object at 0x7fecd58342f0>
JamfPackageUploader: Package uploaded successfully, ID=8831
JamfPackageUploader: WARNING: Package 'UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg' upload failed
JamfPackageUploader: b'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><uploadResponse><id>8831</id><md5>a18574a191df0be522cf55d168c04d60</md5><message></message><receivedSize>14252</receivedSize><successful>true</successful></uploadResponse>'
ERROR: Package upload failed.
Failed.

Looks like the HTTP response is not being decoded properly but I can't tell for sure.
The sanitized full output is below along with
/tmp/jamf_upload/curl_output_from_jamf_upload.txt
I am seeing this from 2 10.15.7 devices with Jamf Pro 10.27.0 and 10.28.0.
The package does in fact upload and eventually become available.
Also note that if I run the same command a second time it fails to detect that the package with the same name already exists.
Thanks!

 tail -f /tmp/jamf_upload/curl_output_from_jamf_upload.txt 
   <title>Status page</title>
</head>
<body style="font-family: sans-serif;">
<p style="font-size: 1.2em;font-weight: bold;margin: 1em 0px;">Not Found</p>
<p>The server has not found anything matching the request URI</p>
<p>You can get technical details <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">here</a>.<br>
Please continue your visit at our <a href="/">home page</a>.
</p>
</body>
</html>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><uploadResponse><id>8831</id><md5>a18574a191df0be522cf55d168c04d60</md5><message></message><receivedSize>14252</receivedSize><successful>true</successful></uploadResponse>^C

Full -vv output from autopkg sanitized

autopkg run --recipe-list=/Users/user/Library/AutoPkg/recipe_list.txt -vv
Processing com.github.grahampugh.recipes.download.rosetta...
WARNING: com.github.grahampugh.recipes.download.rosetta is missing trust info and FAIL_RECIPES_WITHOUT_TRUST_INFO is not set. Proceeding...
GitHubReleasesInfoProvider
{'Input': {'asset_regex': '^Rosetta-2-install.*?.signed.pkg$',
           'github_repo': 'grahampugh/Rosetta-2-install',
           'include_prereleases': True}}
GitHubReleasesInfoProvider: No value supplied for CURL_PATH, setting default value of: /usr/bin/curl
GitHubReleasesInfoProvider: No value supplied for GITHUB_URL, setting default value of: https://api.github.com
GitHubReleasesInfoProvider: No value supplied for GITHUB_TOKEN_PATH, setting default value of: ~/.autopkg_gh_token
GitHubReleasesInfoProvider: Matched regex '^Rosetta-2-install.*?.signed.pkg$' among asset(s): Rosetta-2-install-1.0.pkg, Rosetta-2-install-1.0.signed.pkg
GitHubReleasesInfoProvider: Selected asset 'Rosetta-2-install-1.0.signed.pkg' from release '1.0'
{'Output': {'url': 'https://github.com/grahampugh/Rosetta-2-install/releases/download/v1.0/Rosetta-2-install-1.0.signed.pkg',
            'version': '1.0'}}
URLDownloader
{'Input': {'url': 'https://github.com/grahampugh/Rosetta-2-install/releases/download/v1.0/Rosetta-2-install-1.0.signed.pkg'}}
URLDownloader: No value supplied for prefetch_filename, setting default value of: False
URLDownloader: No value supplied for CHECK_FILESIZE_ONLY, setting default value of: False
URLDownloader: Storing new Last-Modified header: Wed, 25 Nov 2020 11:16:21 GMT
URLDownloader: Storing new ETag header: "a18574a191df0be522cf55d168c04d60"
URLDownloader: Downloaded /Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg
{'Output': {'download_changed': True,
            'etag': '"a18574a191df0be522cf55d168c04d60"',
            'last_modified': 'Wed, 25 Nov 2020 11:16:21 GMT',
            'pathname': '/Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg',
            'url_downloader_summary_result': {'data': {'download_path': '/Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg'},
                                              'summary_text': 'The following '
                                                              'new items were '
                                                              'downloaded:'}}}
EndOfCheckPhase
{'Input': {}}
{'Output': {}}
CodeSignatureVerifier
{'Input': {'expected_authority_names': ['Developer ID Installer: ETH Zurich '
                                        '(9Z623UDZ5L)',
                                        'Developer ID Certification Authority',
                                        'Apple Root CA'],
           'input_path': '/Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg'}}
CodeSignatureVerifier: Verifying installer package signature...
CodeSignatureVerifier: Package "Rosetta-2-install-1.0.signed.pkg":
CodeSignatureVerifier:    Status: signed by a developer certificate issued by Apple for distribution
CodeSignatureVerifier:    Signed with a trusted timestamp on: 2020-11-25 11:08:08 +0000
CodeSignatureVerifier:    Certificate Chain:
CodeSignatureVerifier:     1. Developer ID Installer: ETH Zurich (9Z623UDZ5L)
CodeSignatureVerifier:        Expires: 2023-07-14 11:57:10 +0000
CodeSignatureVerifier:        SHA256 Fingerprint:
CodeSignatureVerifier:            F3 D1 C1 96 3F BD 08 64 92 F4 05 77 57 0B 49 8C 68 47 85 DA 77 AB 
CodeSignatureVerifier:            F2 BE 1C DD BC 0B A6 51 15 F7
CodeSignatureVerifier:        ------------------------------------------------------------------------
CodeSignatureVerifier:     2. Developer ID Certification Authority
CodeSignatureVerifier:        Expires: 2027-02-01 22:12:15 +0000
CodeSignatureVerifier:        SHA256 Fingerprint:
CodeSignatureVerifier:            7A FC 9D 01 A6 2F 03 A2 DE 96 37 93 6D 4A FE 68 09 0D 2D E1 8D 03 
CodeSignatureVerifier:            F2 9C 88 CF B0 B1 BA 63 58 7F
CodeSignatureVerifier:        ------------------------------------------------------------------------
CodeSignatureVerifier:     3. Apple Root CA
CodeSignatureVerifier:        Expires: 2035-02-09 21:40:36 +0000
CodeSignatureVerifier:        SHA256 Fingerprint:
CodeSignatureVerifier:            B0 B1 73 0E CB C7 FF 45 05 14 2C 49 F1 29 5E 6E DA 6B CA ED 7E 2C 
CodeSignatureVerifier:            68 C5 BE 91 B5 A1 10 01 F0 24
CodeSignatureVerifier: 
CodeSignatureVerifier: Signature is valid
CodeSignatureVerifier: Authority name chain is valid
{'Output': {}}
io.github.hjuutilainen.VirusTotalAnalyzer/VirusTotalAnalyzer
{'Input': {'CURL_PATH': '/usr/bin/curl',
           'VIRUSTOTAL_ALWAYS_REPORT': True,
           'VIRUSTOTAL_AUTO_SUBMIT': True,
           'pathname': '/Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg'}}
VirusTotalAnalyzer: Calculating checksum for /Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg
VirusTotalAnalyzer: Requesting report...
VirusTotalAnalyzer: Response code: 1
VirusTotalAnalyzer: Message: Scan finished, information embedded
VirusTotalAnalyzer: Scan ID: b6ef466e0503ac824f705abd460c8a8e47b3b48ebaceb57a5d2c7f2415a35992-1617213903
VirusTotalAnalyzer: Detection ratio: 0/56
VirusTotalAnalyzer: Scan date: 2021-03-31 18:05:03
VirusTotalAnalyzer: Permalink: https://www.virustotal.com/gui/file/b6ef466e0503ac824f705abd460c8a8e47b3b48ebaceb57a5d2c7f2415a35992/detection/f-b6ef466e0503ac824f705abd460c8a8e47b3b48ebaceb57a5d2c7f2415a35992-1617213903
{'Output': {'virus_total_analyzer_summary_result': {'data': {'name': 'Rosetta-2-install-1.0.signed.pkg',
                                                             'permalink': 'https://www.virustotal.com/gui/file/b6ef466e0503ac824f705abd460c8a8e47b3b48ebaceb57a5d2c7f2415a35992/detection/f-b6ef466e0503ac824f705abd460c8a8e47b3b48ebaceb57a5d2c7f2415a35992-1617213903',
                                                             'ratio': '0/56'},
                                                    'report_fields': ['name',
                                                                      'ratio',
                                                                      'permalink'],
                                                    'summary_text': 'The '
                                                                    'following '
                                                                    'items '
                                                                    'were '
                                                                    'queried '
                                                                    'from the '
                                                                    'VirusTotal '
                                                                    'database:'}}}
com.github.everetteallen.ega-recipes.postprocessors/PKGPrefixer
{'Input': {'pkg_prefix': 'UNCSystem-AutoPkg-'}}
PKGPrefixer: No value supplied for pkg_name, setting default value of: 
PKGPrefixer: No value supplied for pkg_path, setting default value of: 
{'Output': {'pkg_name': 'UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg',
            'pkg_path': '/Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg',
            'pkg_prefixer_summary_result': {'data': {'pkg_name': 'UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg',
                                                     'pkg_path': '/Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg'},
                                            'report_fields': ['pkg_path',
                                                              'pkg_name'],
                                            'summary_text': 'The following '
                                                            'package was '
                                                            'renamed:'}}}
com.github.grahampugh.jamf-upload.processors/JamfPackageUploader
{'Input': {'API_PASSWORD': '<uwish>',
           'API_USERNAME': 'autopkg',
           'JSS_URL': 'https://nope.jamfcloud.com',
           'pkg_category': 'aaUNC-System',
           'pkg_name': 'UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg',
           'pkg_path': '/Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg',
           'replace_pkg': 'False',
           'version': '1.0'}}
JamfPackageUploader: No value supplied for pkg_info, setting default value of: 
JamfPackageUploader: No value supplied for pkg_notes, setting default value of: 
JamfPackageUploader: No value supplied for pkg_priority, setting default value of: 10
JamfPackageUploader: No value supplied for reboot_required, setting default value of: 
JamfPackageUploader: No value supplied for os_requirement, setting default value of: 
JamfPackageUploader: No value supplied for required_processor, setting default value of: None
JamfPackageUploader: No value supplied for send_notification, setting default value of: 
JamfPackageUploader: No value supplied for replace_pkg_metadata, setting default value of: False
JamfPackageUploader: No value supplied for SMB_URL, setting default value of: 
JamfPackageUploader: No value supplied for SMB_USERNAME, setting default value of: 
JamfPackageUploader: No value supplied for SMB_PASSWORD, setting default value of: 
JamfPackageUploader: Checking for existing 'UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg' on https://nc.jamfcloud.com
JamfPackageUploader: No existing cookie found - starting new session
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   439  100   439    0     0   2660      0 --:--:-- --:--:-- --:--:--  2660
JamfPackageUploader: No existing cookie found - starting new session
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 14478    0   226  100 14252      0     56  0:04:14  0:04:14 --:--:--    51
JamfPackageUploader: HTTP response: <property object at 0x7fecd58342f0>
JamfPackageUploader: Package uploaded successfully, ID=8831
JamfPackageUploader: WARNING: Package 'UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg' upload failed
JamfPackageUploader: b'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><uploadResponse><id>8831</id><md5>a18574a191df0be522cf55d168c04d60</md5><message></message><receivedSize>14252</receivedSize><successful>true</successful></uploadResponse>'
ERROR: Package upload failed.
Failed.
Receipt written to /Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/receipts/com.github.grahampugh.recipes.download-receipt-20210401-130815.plist

The following recipes failed:
    com.github.grahampugh.recipes.download.rosetta
        Error in com.github.grahampugh.recipes.download.rosetta: Processor: com.github.grahampugh.jamf-upload.processors/JamfPackageUploader: Error: ERROR: Package upload failed.

The following new items were downloaded:
    Download Path                                                                                                               
    -------------                                                                                                               
    /Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg  

The following items were queried from the VirusTotal database:
    Name                              Ratio  Permalink                                                                                                                                                                                     
    ----                              -----  ---------                                                                                                                                                                                     
    Rosetta-2-install-1.0.signed.pkg  0/56   https://www.virustotal.com/gui/file/b6ef466e0503ac824f705abd460c8a8e47b3b48ebaceb57a5d2c7f2415a35992/detection/f-b6ef466e0503ac824f705abd460c8a8e47b3b48ebaceb57a5d2c7f2415a35992-1617213903  

The following package was renamed:
    Pkg Path                                                                                                                    Pkg Name                                            
    --------                                                                                                                    --------                                            
    /Users/user/Library/AutoPkg/Cache/com.github.grahampugh.recipes.download.rosetta/downloads/Rosetta-2-install-1.0.signed.pkg  UNCSystem-AutoPkg-Rosetta-2-install-1.0.signed.pkg 

No Token Found

Hi all,

I'm new to this and setting things up for the first time. I'm attempting to upload GrahamPugh's firefox upload package to Jamf and get the following error:

Error in com.github.autopkg.grahampugh-recipes.jamf.Firefox-pkg-upload: Processor: com.github.grahampugh.jamf-upload.processors/JamfCategoryUploader: Error: No token found, cannot continue

Any help would be appreciated! - Thanks

Improve asset file search

The file search function should look in these places (in this order):

  • RecipeOverrides directory/ies
  • Same directory as the recipe
  • Same repo (recipe search directory) as the recipe
  • Parent recipe's repo (recipe search directory) if recipe is an override

I did a bit of testing, and the PARENT_RECIPES list always has the immediate parent first, so we can use the first item in the list.

It would also be good to allow people who don't use overrides to still have files in the same repo as the recipe (items 2 and 3 above). This depends on a recipe override being somewhere in RECIPE_OVERRIDES_DIRS, but AutoPkg also relies on that logic, so it's no additional restriction.

JamfPolicyUploader processor failing with errors when updating policies

I'm seeing a problem with the JamfPolicyUploader processor when running various policies which use it. An example is posted below:

JamfPolicyUploader: No value supplied for icon, setting default value of: 
JamfPolicyUploader: No value supplied for replace_icon, setting default value of: False
JamfPolicyUploader: File found at: /Users/ec2-user/Library/AutoPkg/RecipeRepos/com.github.rtrouton.autopkg_recipes/Jamf_Upload/PolicyTemplate-autoupdate.xml
JamfPolicyUploader: ("Replacing any instances of 'POLICY_NAME' with", "'Auto Update CiscoUmbrella'")
JamfPolicyUploader: ("Replacing any instances of 'POLICY_CATEGORY' with", "'Apps-AutoUpdate'")
JamfPolicyUploader: ("Replacing any instances of 'POLICY_TRIGGER' with", "'autoupdate-CiscoUmbrella'")
JamfPolicyUploader: ("Replacing any instances of 'pkg_name' with", "'Cisco_Umbrella_3.0.9.pkg'")
JamfPolicyUploader: Policy data:
JamfPolicyUploader: <?xml version="1.0" encoding="UTF-8"?>
<policy>
   <general>
      <name>Auto Update CiscoUmbrella</name>
      <enabled>true</enabled>
      <frequency>Ongoing</frequency>
      <category>
         <name>Apps-AutoUpdate</name>
      </category>
      <trigger_other>autoupdate-CiscoUmbrella</trigger_other>
   </general>
   <scope>
      <all_computers>true</all_computers>
   </scope>
   <package_configuration>
      <packages>
         <size>1</size>
         <package>
            <name>Cisco_Umbrella_3.0.9.pkg</name>
            <action>Install</action>
         </package>
      </packages>
   </package_configuration>
   <scripts>
      <size>0</size>
   </scripts>
   <maintenance>
      <recon>true</recon>
   </maintenance>
</policy>
JamfPolicyUploader: Checking for existing 'Auto Update CiscoUmbrella' on https://jamf.pro.server.here
JamfPolicyUploader: Checking for existing authentication token
JamfPolicyUploader: Checking https://jamf.pro.server.here against https://jamf.pro.server.here
JamfPolicyUploader: URL for token matches current request
JamfPolicyUploader: Existing token is valid
JamfPolicyUploader: No existing cookie found - starting new session
JamfPolicyUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://jamf.pro.server.here/api/v1/jamf-pro-version --request GET --header authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMzE3ZTcyMWQtMzBjYi00ZjM3LWE3MDEtMDhhN2QyMWJhYzM1IiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIyMCIsImV4cCI6MTY0Njk0MDc2M30.g4Cv9b7TOPyZP1zWPNK1SMO5c-9LxnUGTMBGnuuyY0k --header Accept: application/json
JamfPolicyUploader: Jamf Pro Version: 10.37.0-b.2.t1645716981
JamfPolicyUploader: Token auth will be used, 
JamfPolicyUploader: No existing cookie found - starting new session
JamfPolicyUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://jamf.pro.server.here/JSSResource/policies --request GET --header authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMzE3ZTcyMWQtMzBjYi00ZjM3LWE3MDEtMDhhN2QyMWJhYzM1IiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIyMCIsImV4cCI6MTY0Njk0MDc2M30.g4Cv9b7TOPyZP1zWPNK1SMO5c-9LxnUGTMBGnuuyY0k --header Accept: application/json
JamfPolicyUploader: Policy 'Auto Update CiscoUmbrella' already exists: ID 2459
JamfPolicyUploader: Replacing existing policy as 'replace_policy' is set to True
JamfPolicyUploader: Uploading Policy...
JamfPolicyUploader: Policy upload attempt 1
JamfPolicyUploader: No existing cookie found - starting new session
JamfPolicyUploader: curl command: /usr/bin/curl --silent --show-error -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://jamf.pro.server.here/JSSResource/policies/id/2459 --request PUT --header authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiMzE3ZTcyMWQtMzBjYi00ZjM3LWE3MDEtMDhhN2QyMWJhYzM1IiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiIyMCIsImV4cCI6MTY0Njk0MDc2M30.g4Cv9b7TOPyZP1zWPNK1SMO5c-9LxnUGTMBGnuuyY0k --upload-file /tmp/jamf_upload/jamf_upload_d7e5facc-6b51-4a4a-8b17-25a51698654a.txt --header Content-type: application/xml
JamfPolicyUploader: 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 with package</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/ec2-user/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPolicyUploader.py", line 304, in main
    token=token,
  File "/Users/ec2-user/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfPolicyUploader.py", line 134, in upload_policy
    if self.status_check(r, "Policy", policy_name, request) == "break":
  File "/Users/ec2-user/Library/AutoPkg/RecipeRepos/com.github.autopkg.grahampugh-recipes/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py", line 396, in status_check
    f"WARNING: {endpoint_type} '{obj_name}' {action} failed due to a conflict"
autopkglib.ProcessorError: WARNING: Policy 'Auto Update CiscoUmbrella' update failed due to a conflict
  File "/Library/AutoPkg/autopkglib/__init__.py", line 840, in process
    self.env = processor.process()
Receipt written to /Users/ec2-user/Library/AutoPkg/Cache/local.jamf.CiscoUmbrella-App-AutoUpdate/receipts/local.jamf-receipt-20220310-190539.plist

As far as I can tell, the XML for the policy template is formatted correctly (please see below):

<?xml version="1.0" encoding="UTF-8"?>
<policy>
   <general>
      <name>%POLICY_NAME%</name>
      <enabled>true</enabled>
      <frequency>Ongoing</frequency>
      <category>
         <name>%POLICY_CATEGORY%</name>
      </category>
      <trigger_other>%POLICY_TRIGGER%</trigger_other>
   </general>
   <scope>
      <all_computers>true</all_computers>
   </scope>
   <package_configuration>
      <packages>
         <size>1</size>
         <package>
            <name>%pkg_name%</name>
            <action>Install</action>
         </package>
      </packages>
   </package_configuration>
   <scripts>
      <size>0</size>
   </scripts>
   <maintenance>
      <recon>true</recon>
   </maintenance>
</policy>

Full sanitized verbose output of the AutoPkg run is attached as "JamfPolicyUploader_error_processor.txt."
JamfPolicyUploader_error_processor.txt

Enable use of API certificate

Issue raised in MacAdmins Slack DM by Kornel:

If using a certificate for authenticating via API, so we not only need to provide API credentials in Autopkg prefs file but also point to a local .pem file.

This should be possible to add as a curl parameter, like this:

        if cert:
            curl_cmd.extend(["--cert", self.env.get("CLIENT_CERT_PATH")]) 

Dependency Conflict

I started running into this issue a few days ago. My pipeline keeps pip up-to-date, and it looks like there may be an issue with the new dependency resolver and the requirements.txt for jamf-upload.

To verify this issue, I created a fresh venv on my workstation, cloned a fresh copy of the repo, updated pip, and tried installing the dependencies. See below:

(jamf_upload) % python -m pip install -r jamf-upload/requirements.txt
Collecting certifi==2020.6.20
  Using cached certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting chardet==3.0.4
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting idna==2.10
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting requests==2.24.0
  Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting requests-toolbelt==0.9.1
  Using cached requests_toolbelt-0.9.1-py2.py3-none-any.whl (54 kB)
Collecting six==1.15.0
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Collecting urllib3==1.26.5
  Using cached urllib3-1.26.5-py2.py3-none-any.whl (138 kB)
INFO: pip is looking at multiple versions of <Python from Requires-Python> to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of idna to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of chardet to determine which version is compatible with other requirements. This could take a while.
INFO: pip is looking at multiple versions of certifi to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install -r jamf-upload/requirements.txt (line 4) and urllib3==1.26.5 because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested urllib3==1.26.5
    requests 2.24.0 depends on urllib3!=1.25.0, !=1.25.1, <1.26 and >=1.21.1

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies

A better link for the fixing conflicting dependencies URL is: https://pip.pypa.io/en/latest/topics/dependency-resolution/

unconverted data remains: Z

Sometimes we get this error which makes a recipe fail. I suspect it's something to do with the way we are measuring expiry of tokens.

create multiple policies with JamfPolicyUploader

Hi Guys,

I'm trying to create one jamf recipe, which creates one jamf patch policy and two normal policies. Is it possible to create two policies with one jamf recipe? The reason I ask is that I got an error message as soon as I add the second JamfPolicyUploader:

The following recipes failed: local.jamf.RocketChat Error in local.jamf.RocketChat: Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader: Error: 'NoneType' object has no attribute 'startswith'

The processors in my recipe:

- Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
  Arguments:
    provisioning_policy_name: '%PROVISIONING_POLICY_NAME%'
    provisioning_trigger: '%PROVISIONING_TRIGGER%'
    provisioning_category: '%PROVISIONING_CATEGORY%'
    provisioning_policy_template: '%PROVISIONING_POLICY_TEMPLATE%'
    replace_policy: 'true'
- Processor: com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
  Arguments:
    icon: '%SELFSERVICE_ICON%'
    policy_name: '%SELFSERVICE_POLICY_NAME%'
    selfserivce_category: '%SELFSERVICE_CATEGORY%'
    selfservice_display_name: '%SELFSERVICE_DISPLAY_NAME%'
    selfservice_description: '%SELFSERVICE_DESCRIPTION%'
    selfservice_main_page: '%SELFSERVICE_MAIN_PAGE%'
    selfservice_force_description: '%SELFSERVICE_FORCE_DESCRIPTION%'
    policy_template: '%SELFSERVICE_POLICY_TEMPLATE%'
    replace_policy: 'true'
    replace_icon: 'true'

Best regards

Cookie issues against Jamf Pro 10.26.0 cloud using jamf_api_tool.py....

Not seeing an error but not connecting:

jamf_api_tool.py --prefs ~/Library/Preferences/com.github.autopkg.plist --packages --unused --verbose

** Jamf API Tool for Jamf Pro.

No existing cookie found - starting new session

curl command:
/usr/bin/curl -X POST -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://nc.jamfcloud.com:443//uapi/auth/tokens --header authorization: Basic xxxxx= --header Content-type: application/json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 379 0 379 0 0 945 0 --:--:-- --:--:-- --:--:-- 945
ERROR: No token received
No existing cookie found - starting new session

curl command:
/usr/bin/curl -X GET -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://nc.jamfcloud.com:443//uapi/v2/computer-prestages?page=0&page-size=1000&sort=id%3Adesc --header authorization: Bearer None --header Accept: application/json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 42 0 42 0 0 229 0 --:--:-- --:--:-- --:--:-- 229
No existing cookie found - starting new session

curl command:
/usr/bin/curl -X GET -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://nc.jamfcloud.com:443//JSSResource/patchsoftwaretitles --header authorization: Basic xxxxx= --header Accept: application/json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 796 100 796 0 0 2680 0 --:--:-- --:--:-- --:--:-- 2671
No existing cookie found - starting new session

curl command:
/usr/bin/curl -X GET -D /tmp/jamf_upload/curl_headers_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt https://nc.jamfcloud.com:443//JSSResource/policies --header authorization: Basic xxxxxx= --header Accept: application/json
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 796 100 796 0 0 2981 0 --:--:-- --:--:-- --:--:-- 2981

Feature Request: Allow Autopkg Processors to extend curl options

The current implementation does not allow for extending curl options down to the CURL call. This prevents us from specifying additional options (like a cookie jar) to attach to the curl call to pass through our federated access.

Initial thoughts are to support recipe options or a preference array of the options to pull into every jamf-upload run to extend the internal curl calls.

If this can be specified now, I haven't been able to find that in the code as a way around it via recipe or override.

JamfPolicyUploader Conflict "Error: Problem with script"

Hallo Graham,

i'm using your greate JamfPolicyUploader but i'm getting following Error ( i don't understand why? is that an Issue with script? )

com.github.grahampugh.jamf-upload.processors/JamfPolicyUploader
{'Input': {'API_PASSWORD': 'API_PASSWORD',
'API_USERNAME': 'API_USERNAME',
'JSS_URL': 'JSS_URL',
'icon': 'Firefox.png',
'policy_name': 'Install_Firefox',
'policy_template': 'policy_template',
'replace_policy': 'True'}}
JamfPolicyUploader: No value supplied for replace_icon, setting default value of: False
JamfPolicyUploader: File found at: /path/to/policy
JamfPolicyUploader: ("Replacing any instances of 'POLICY_NAME' with", "'Install_Firefox'")
JamfPolicyUploader: ("Replacing any instances of 'NAME' with", "'Firefox'")
JamfPolicyUploader: ("Replacing any instances of 'POLICY_CATEGORY' with", "'Browser'")
JamfPolicyUploader: ("Replacing any instances of 'pkg_name' with", "'Firefox-99.0.pkg'")
JamfPolicyUploader: ("Replacing any instances of 'PATH_TO_APP' with", "'/Applications/Firefox.app'")
JamfPolicyUploader: ("Replacing any instances of 'SELF_SERVICE_DISPLAY_NAME' with", "'Mozilla Firefox'")
JamfPolicyUploader: ("Replacing any instances of 'INSTALL_BUTTON_TEXT' with", "'Install'")
JamfPolicyUploader: ("Replacing any instances of 'REINSTALL_BUTTON_TEXT' with", "'Reinstall'")
JamfPolicyUploader: ("Replacing any instances of 'SELF_SERVICE_DESCRIPTION' with", "'Mozilla Firefox is a free Web Browser.'")
JamfPolicyUploader: Policy data:
JamfPolicyUploader: <?xml version="1.0" encoding="UTF-8"?>
<policy>
<general>
<name>Install_Firefox</name>
<enabled>true</enabled>
<frequency>Ongoing</frequency>
<trigger_other>Install_Firefox</trigger_other>
<category>
<name>Browser</name>
</category>
</general>
<scope>
<all_computers>true</all_computers>
</scope>
<package_configuration>
<packages>
<size>1</size>
<package>
<name>Firefox-99.0.pkg</name>
<action>Install</action>
</package>
</packages>
</package_configuration>
<scripts>
<size>1</size>
<script>
<id>1</id>
<name>dockutil_add</name>
<priority>After</priority>
<parameter4>/Applications/Firefox.app</parameter4>
</script>
</scripts>
<self_service>
<use_for_self_service>true</use_for_self_service>
<self_service_display_name>Mozilla Firefox</self_service_display_name>
<install_button_text>Install</install_button_text>
<reinstall_button_text>Reinstall</reinstall_button_text>
<self_service_description>Mozilla Firefox is a free Web Browser.</self_service_description>
<feature_on_main_page>false</feature_on_main_page>
</self_service>
<maintenance>
<recon>true</recon>
</maintenance>
</policy>
JamfPolicyUploader: Checking for existing 'Install_Firefox' on JSS_URL
JamfPolicyUploader: Checking for existing authentication token
JamfPolicyUploader: Checking JSS_URL against JSS_URL
JamfPolicyUploader: URL for token matches current request
JamfPolicyUploader: Existing token is valid
JamfPolicyUploader: Existing cookie found: APBALANCEID=APBALANCEID
JamfPolicyUploader: Jamf Pro Version: 10.37.2-t1648851072
JamfPolicyUploader: Token auth will be used,
JamfPolicyUploader: Existing cookie found: APBALANCEID=APBALANCEID
JamfPolicyUploader: Policy 'Install_Firefox' already exists: ID 225
JamfPolicyUploader: Replacing existing policy as 'replace_policy' is set to True
JamfPolicyUploader: Uploading Policy...
JamfPolicyUploader: Policy upload attempt 1
JamfPolicyUploader: Existing cookie found: APBALANCEID=APBALANCEID
JamfPolicyUploader: 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 with script</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](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.10%22%3Ehere%3C/a%3E.%3Cbr%3E\nPlease) continue your visit at our <a href="/">home page</a>.\n</p>\n</body>\n</html>\n'
WARNING: Policy 'Install_Firefox' update failed due to a conflict
Failed.
Receipt written to /path/to/cached/recipe

READMEs missing some input variables

Some of the READMEs are missing documentation on some of the input variables, most notably sleep, but a few others are missing also. I found these while working on #104.

I will raise a PR with suggested corrections.

upload of larger pkgs (> 1GB) fails with jamf uploader

Somehow uploading pkgs which are larger than 1 GB fails. The curl process hangs almost always at exactly 1,12 GB. Tried it with a different mac, same error. Different network connection, same error.

We are using Jamf Cloud.

Any idea what that could be?

I tried it with autopkg processors and manually with the jamf_pkg_upload.py. Stops exactly at the same time.

Thanks for your help

lenny

Package upload stuck on Availability Pending

I am having issues uploading a package using the JamfPackageUploader processor. It looks like everything uploads correctly but then the package stays in the Pending state on JamfCloud and if I look in Jamf Admin, it says the package is missing.

image

I have tried with several different packages, different recipes. Always the same issue. If I upload the file manually, it works. I'm happy to provide whatever logs you need.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.