grahampugh / jamf-upload

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

Feature Request: Allow Autopkg Processors to extend curl options #109

Open WardsParadox opened 1 year ago

WardsParadox commented 1 year ago

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.

grahampugh commented 1 year ago

It cannot be specified now. It's also something I would not be able to test since we don't have any special federated access. If you can give me an example of what sort of curl options you typically pass in other AutoPkg recipes to make them work, that might help.

WardsParadox commented 1 year ago

Normally I pass something like ['--cookie-jar', '~/.tool/cookie'] where our internal CLI auth tool writes the cookie jar.

grahampugh commented 1 year ago

The cookie-jar is pre-defined in JamfUploader, and is used to ensure that you get a consistent cluster node behind the scenes which is essential when running multiple, co-dependent API calls in quick succession. If you overwrote it with your own you would probably break it.

WardsParadox commented 1 year ago

Sorry correction, we have a cookie file, not a cookie jar. My mistakes. Being able to specify an additional cookie would be tremendously helpful.

grahampugh commented 1 year ago

I don't know enough about curl off the bat to known if you can supply multiple cookie files. I use --cookie and --cookie-jar, as these work as read and write options as far as I can tell. See https://github.com/grahampugh/jamf-upload/blob/main/JamfUploaderProcessors/JamfUploaderLib/JamfUploaderBase.py#L371-L387

WardsParadox commented 1 year ago

I just tested, you can indeed specify multiple --cookie files.

WardsParadox commented 1 year ago

Since this will pull in via recipe override or preferences, thoughts on making this a preference level like JU_CURL_OPTS? Can be specified as either a preference or an override variable since we're just pulling those in via self.env.get?