grahampugh / jamf-upload

Scripts for uploading packages to Jamf Cloud
Apache License 2.0
147 stars 37 forks source link

Package metadata creation fails #126

Closed pyther closed 5 months ago

pyther commented 9 months ago

Package metadata creation fails when JSS_URL contains a trailing slash (https://acme.jamfcloud.com/). Removing the trailing slash from JSS_URL allow the package metadata to be created successfully.

I've had a trailing slash in my JSS_URL since I've started using autopkg and jamf-upload. Presumably there was a recent change to the Jamf infrastructure that resulted in this breakage.

Reporting this issue, as it might be reasonable to strip the trailing slash from JSS_URL or at minimum dispaly a warning. I suspect others will run into this issue as well.

Including output of the failed upload, taken when JSS_URL => https://acme.jamfcloud.com/.

JamfPackageUploader: Package already exists in the S3 bucket.
JamfPackageUploader: Creating package metadata
JamfPackageUploader: <package><name>Firefox-119.0.1.pkg</name><filename>Firefox-119.0.1.pkg</filename><category></category><info></info><notes></notes><priority>10</priority><reboot_required>False</reboot_required><required_processor>None</required_processor><os_requirements></os_requirements><send_notification>False</send_notification></package>
JamfPackageUploader: Package metadata upload attempt 1
JamfPackageUploader: Output file is:  /tmp/jamf_upload_0jkq7z6g/jamf_upload_677zj4d3.txt
JamfPackageUploader: curl command: /usr/bin/curl --dump-header /tmp/jamf_upload_20k27cu8/curl_headers_from_jamf_upload.txt https://redacted.jamfcloud.com//JSSResource/packages/id/0 --request POST --silent --show-error --header authorization: Bearer REDACTED --upload-file /tmp/jamf_upload_0jkq7z6g/jamf_upload_677zj4d3.txt --header Content-type: application/xml --output /tmp/jamf_upload_20k27cu8/jamf_upload_cng9m0n9.txt --cookie-jar /tmp/jamf_upload_20k27cu8/curl_cookies_from_jamf_upload.txt --cookie /tmp/jamf_upload_20k27cu8/curl_cookies_from_jamf_upload.txt
JamfPackageUploader: API response:
b'<!doctype html><html lang="en"><head><title>HTTP Status 404 \xe2\x80\x93 Not Found</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 \xe2\x80\x93 Not Found</h1></body></html>'
grahampugh commented 5 months ago

This is now solved (thanks to PRs from @rickokid)