From 726ea0f84308d11cbb0fade9bf5e580a22040de0 Mon Sep 17 00:00:00 2001 From: Walid Boussaffa Date: Wed, 27 Jan 2021 14:28:03 +0100 Subject: [PATCH] (GH-886) added support for force and timeout in packages.config file --- .../commands/ChocolateyInstallCommand.cs | 2 +- .../configuration/PackagesConfigFilePackageSetting.cs | 7 +++++++ .../services/ChocolateyPackageService.cs | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs index a6f873e81b..6936f2ec70 100644 --- a/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs +++ b/src/chocolatey/infrastructure.app/commands/ChocolateyInstallCommand.cs @@ -370,7 +370,7 @@ Chocolatey Professional showing private download cache and virus scan diff --git a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs index 713067673b..49da57082a 100644 --- a/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs +++ b/src/chocolatey/infrastructure.app/configuration/PackagesConfigFilePackageSetting.cs @@ -58,5 +58,12 @@ public sealed class PackagesConfigFilePackageSetting [XmlAttribute(AttributeName = "disabled")] public bool Disabled { get; set; } + + [System.ComponentModel.DefaultValue(-1)] + [XmlAttribute(AttributeName = "timeout")] + public int Timeout { get; set; } + + [XmlAttribute(AttributeName = "force")] + public bool Force { get; set; } } } diff --git a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs index 2143f89c40..c1815a3522 100644 --- a/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs +++ b/src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs @@ -736,6 +736,8 @@ private IEnumerable get_packages_from_config(string pac if (pkgSettings.ApplyPackageParametersToDependencies) packageConfig.ApplyPackageParametersToDependencies = true; SourceType sourceType; if (Enum.TryParse(pkgSettings.Source, true, out sourceType)) packageConfig.SourceType = sourceType; + if (pkgSettings.Force) packageConfig.Force = true; + packageConfig.CommandExecutionTimeoutSeconds = pkgSettings.Timeout == -1 ? packageConfig.CommandExecutionTimeoutSeconds : pkgSettings.Timeout; this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(packageConfig.PackageNames)); packageConfigs.Add(packageConfig);