Skip to content

Commit

Permalink
Merge pull request #2187 from boussaffawalid/support-more-switches-pa…
Browse files Browse the repository at this point in the history
…ckages.config

(#886) added support for force and timeout in packages.config file
  • Loading branch information
gep13 authored Aug 11, 2022
2 parents 67190e5 + 867403b commit 2139d2a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Chocolatey Professional showing private download cache and virus scan
<package id=""alloptions"" version=""0.1.1""
source=""https://somewhere/api/v2/"" installArguments=""""
packageParameters="""" forceX86=""false"" allowMultipleVersions=""false""
ignoreDependencies=""false""
ignoreDependencies=""false"" commandExecutionTimeoutSeconds=""1000"" force=""false""
/>
</packages>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,12 @@ public sealed class PackagesConfigFilePackageSetting

[XmlAttribute(AttributeName = "disabled")]
public bool Disabled { get; set; }

[System.ComponentModel.DefaultValue(-1)]
[XmlAttribute(AttributeName = "commandExecutionTimeoutSeconds")]
public int CommandExecutionTimeoutSeconds { get; set; }

[XmlAttribute(AttributeName = "force")]
public bool Force { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,8 @@ private IEnumerable<ChocolateyConfiguration> 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.CommandExecutionTimeoutSeconds == -1 ? packageConfig.CommandExecutionTimeoutSeconds : pkgSettings.CommandExecutionTimeoutSeconds;

this.Log().Info(ChocolateyLoggers.Important, @"{0}".format_with(packageConfig.PackageNames));
packageConfigs.Add(packageConfig);
Expand Down

0 comments on commit 2139d2a

Please sign in to comment.