Skip to content

Commit

Permalink
(chocolatey#2761) Allow overriding remembered params and args
Browse files Browse the repository at this point in the history
This allows overriding of remembered package parameters and install
arguments during upgrade. So a user can pass in different package
parameters or arguments without having to completely reinstall the
package or turn of remembered arguments.

At this point in the remembered arguments, the CacheLocation and
CommandExecutionTimeout are already set even if not passed in
explicitly, so there is no way to check if they are being overridden
by the user.

And the switch also cannot be checked, because the lack of a switch
normally would mean that they are just relying on the remembered args
to remember it.
  • Loading branch information
TheCakeIsNaOH committed Jan 9, 2024
1 parent ecaaf15 commit 8b70577
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/chocolatey/infrastructure.app/services/NugetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,8 @@ protected virtual ChocolateyConfiguration SetConfigFromRememberedArguments(Choco
ConfigurationOptions.OptionSet.Parse(packageArguments);

// there may be overrides from the user running upgrade
if (!string.IsNullOrWhiteSpace(originalConfig.PackageParameters)) config.PackageParameters = originalConfig.PackageParameters;
if (!string.IsNullOrWhiteSpace(originalConfig.InstallArguments)) config.InstallArguments = originalConfig.InstallArguments;
if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Username)) config.SourceCommand.Username = originalConfig.SourceCommand.Username;
if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Password)) config.SourceCommand.Password = originalConfig.SourceCommand.Password;
if (!string.IsNullOrWhiteSpace(originalConfig.SourceCommand.Certificate)) config.SourceCommand.Certificate = originalConfig.SourceCommand.Certificate;
Expand Down

0 comments on commit 8b70577

Please sign in to comment.