saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.16k stars 5.48k forks source link

Need to support --allow-empty-checksums and --ignore-checksums for Chocolatey #38331

Open dragon788 opened 7 years ago

dragon788 commented 7 years ago

Some packages simply won't work with checksums, typically ones that don't have a controlled version release schedule or are pulled from an internal instance of software that doesn't have a set version (like a desktop client for a server application or a build agent for a CI system [TeamCity and Jenkins both supply the agent via the web interface]). In these cases you need to pass --ignore-checksums or --allow-empty-checksums, and it is best to do on a case by case basis rather than setting a global value to ignore them.

Setup

Will be back with more info on 12/19 .

Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Ch3LL commented 7 years ago

@dragon788 can you not pass them with the install_args option?

dragon788 commented 7 years ago

Chocolatey has a ton of command line parameters and aliases for those, and install_args could be more accurately described as "installer_arguments" so they are arguments passed to the MSI or EXE of the program you are trying to install, not arguments to Chocolatey itself.

     --ia, --installargs, --installarguments, --install-arguments=VALUE
     InstallArguments - Install Arguments to pass to the native installer in 
       the package. Defaults to unspecified.

Chocolatey processes all the "dashy" arguments (ie -y -verbose) itself, and only things inside quotes behind a pass-through parameter like --install-args or -params (or possibly that it doesn't understand) will end up making it to a package. This means that for Salt, it will need to understand all the valid arguments to chocolatey install for a package (I've seen there is already helper for -yes) and only if the package doesn't support checksums should Salt pass --ignore-checksums. The tough thing is the metadata about a package doesn't typically give any hints about this requirement either, they simply get marked as "exempt" with a warning that the contents may not always look exactly like the outside as they were unable to verify them during the moderation process.

Chocolatey Install Commands

dragon788 commented 7 years ago

For the --ignore-checksums and other options it might be best handled as a generic "choco_args" that supports a YAML list of extra arguments, as this would avoid hardcoding options that may get deprecated as well as allow referencing the Chocolatey documentation like linked above for other arguments that don't relate to a specific "command" themselves. These extra arguments are usually also valid for multiple commands like install, uninstall, upgrade, etc so they should be parsed separately if present and just supplied as additional "context" to the executed command (eg chocolatey install somepkg $install_args $pkg_args $choco_args).

Ch3LL commented 7 years ago

@dragon788 thanks for clearing that up for me that those options are passed to the exe itself. yeah I like the choco_args approach if there are a ton of options, but it looks like we are already adding validation to a lot of choco commands in the salt chocolatey modules so these two new args could be added there as well. I'll approve as a feature request thanks.

dragon788 commented 7 years ago

I should correct myself, the --ignore-checksums does actually go to the "install" but I think it also applies to "upgrade" in the case of a package that has a new version pushed but the new version didn't have checksums available.

This is the list of global options, https://chocolatey.org/docs/commands-reference#how-to-pass-options-switches .

This is the ones specific to install, https://chocolatey.org/docs/commands-install#options-and-switches .

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

TTimo commented 4 years ago

I think this is still an issue, and salt does not support setting those chocolatey arguments?

TTimo commented 4 years ago

Having to do this as a workaround still:

psexec:
  cmd.run:
    - name: choco install --ignore-checksums psexec
    - unless:
      - fun: file.file_exists
        path: C:\ProgramData\chocolatey\bin\psexec.exe