Skip to content

Commit

Permalink
(chocolateyGH-305) Do not fail by default on auto uninstaller
Browse files Browse the repository at this point in the history
If auto uninstaller fails, do not fail the package by default. Allow
the user to change the feature `failOnAutoUninstaller` to allow for
packages to fail when the uninstall feature fails.
  • Loading branch information
ferventcoder committed Jun 5, 2015
1 parent fb516e4 commit 21c7740
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/chocolatey/infrastructure.app/ApplicationParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public static class Features
{
public static readonly string CheckSumFiles = "checksumFiles";
public static readonly string AutoUninstaller = "autoUninstaller";
public static readonly string FailOnAutoUninstaller = "failOnAutoUninstaller";
public static readonly string AllowGlobalConfirmation = "allowGlobalConfirmation";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ private static void set_feature_flags(ChocolateyConfiguration config, ConfigFile
{
config.Features.CheckSumFiles = set_feature_flag(ApplicationParameters.Features.CheckSumFiles, configFileSettings);
config.Features.AutoUninstaller = set_feature_flag(ApplicationParameters.Features.AutoUninstaller, configFileSettings);
config.Features.FailOnAutoUninstaller = set_feature_flag(ApplicationParameters.Features.FailOnAutoUninstaller, configFileSettings);
config.PromptForConfirmation = !set_feature_flag(ApplicationParameters.Features.AllowGlobalConfirmation, configFileSettings);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ public sealed class FeaturesConfiguration
{
public bool AutoUninstaller { get; set; }
public bool CheckSumFiles { get; set; }
public bool FailOnAutoUninstaller { get; set; }
}

//todo: retrofit other command configs this way
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
<feature name="checksumFiles" enabled="true" />
<feature name="autoUninstaller" enabled="false" />
<feature name="allowGlobalConfirmation" enabled="false" />
<feature name="failOnAutoUninstaller" enabled="false" />
</features>
</chocolatey>
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public void run(PackageResult packageResult, ChocolateyConfiguration config)
Environment.ExitCode = exitCode;
string logMessage = " Auto uninstaller failed. Please remove machine installation manually.{0} Exit code was {1}".format_with(Environment.NewLine, exitCode);
this.Log().Error(() => logMessage);
packageResult.Messages.Add(new ResultMessage(ResultType.Error, logMessage));
packageResult.Messages.Add(new ResultMessage(config.Features.FailOnAutoUninstaller ? ResultType.Error : ResultType.Warn, logMessage));
}
else
{
Expand Down

0 comments on commit 21c7740

Please sign in to comment.