grahampugh / jamf-upload

Scripts for uploading packages to Jamf Cloud
Apache License 2.0
150 stars 39 forks source link

Fix the `--output` option from being passed twice #82

Closed MLBZ521 closed 1 year ago

MLBZ521 commented 2 years ago

The --output <output_file> option was being added to the curl statement multiple times. This prevents that.

Example:

JamfPolicyUploader: Checking for existing 'Firefox' on <https://jps.org:8443>
JamfPolicyUploader: Checking for existing authentication token
JamfPolicyUploader: Checking <https://jps.org:8443> against <https://jps.org:8443>
JamfPolicyUploader: URL and user for token matches current request
JamfPolicyUploader: Existing token is valid
JamfPolicyUploader: curl command: /usr/bin/curl --dump-header /tmp/jamf_upload/curl_headers_from_jamf_upload.txt <https://jps.org:8443>/api/v1/jamf-pro-version --request GET --silent --show-error --header authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJhdXRoZW50aWNhdGVkLWFwcCI6IkdFTkVSSUMiLCJhdXRoZW50aWNhdGlvbi10eXBlIjoiSlNTIiwiZ3JvdXBzIjpbXSwic3ViamVjdC10eXBlIjoiSlNTX1VTRVJfSUQiLCJ0b2tlbi11dWlkIjoiZDBhODBiZjYtOTg0MS00NzczLWI5ZTEtMTY2MmI3MmRhMjE1IiwibGRhcC1zZXJ2ZXItaWQiOi0xLCJzdWIiOiI0OCIsImV4cCI6MTY2NDQwNjcxMX0.YWW1v1qSO8TIaJvV7T1CkYwgezAV9NZUUHxJg_HSXgc --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt --output /tmp/jamf_upload/curl_output_from_jamf_upload.txt --header Accept: application/json --cookie-jar /tmp/jamf_upload/curl_cookies_from_jamf_upload.txt --cookie /tmp/jamf_upload/curl_cookies_from_jamf_upload.txt
MLBZ521 commented 1 year ago

The --output parameter is already being added to the policy_icon and icon endpoints as there are two sets of if conditionals that it's added in.

Specifically, it will added to all curl_cmds due to this conditional:

https://github.com/grahampugh/jamf-upload/blob/59a351ca6ddc4a94f7027493d4040c466fcec147/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py#L306-L311

And then it's potentially added again in the condition that starts: https://github.com/grahampugh/jamf-upload/blob/59a351ca6ddc4a94f7027493d4040c466fcec147/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py#L314-L358

The --output parameter being in the policy_icon and icon endpoints hasn't had any adverse affects on me and I assume anyone as that is how it's currently written. I've reviewed others' verbose runs -vvv+ in other issues posted and have seen the same multiple --output <path> --output <path> parameters in their as well.