Skip to content

Hotfix 2.1.5 #1429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class InvokeServiceControlInstanceUpgrade : PSCmdlet
[Parameter(Mandatory = false, HelpMessage = "Do not automatically create new queues")]
public SwitchParameter SkipQueueCreation { get; set; }

[Parameter(HelpMessage = "Specify the database maintenance port number to listen on. If this is the only ServiceControl instance then 33334 is recommended")]
[ValidateRange(1, 49151)]
public int DatabaseMaintenancePort { get; set; }

protected override void BeginProcessing()
{
Expand All @@ -45,7 +48,15 @@ protected override void ProcessRecord()

foreach (var name in Name)
{
var options = new ServiceControlUpgradeOptions { AuditRetentionPeriod = AuditRetentionPeriod, ErrorRetentionPeriod = ErrorRetentionPeriod, OverrideEnableErrorForwarding = ForwardErrorMessages, SkipQueueCreation = SkipQueueCreation};
var options = new ServiceControlUpgradeOptions
{
AuditRetentionPeriod = AuditRetentionPeriod,
ErrorRetentionPeriod = ErrorRetentionPeriod,
OverrideEnableErrorForwarding = ForwardErrorMessages,
SkipQueueCreation = SkipQueueCreation,
MaintenancePort = DatabaseMaintenancePort == 0 ? (int?)null : DatabaseMaintenancePort
};

var instance = InstanceFinder.FindServiceControlInstance(name);
if (instance == null)
{
Expand Down Expand Up @@ -75,6 +86,11 @@ protected override void ProcessRecord()
ThrowTerminatingError(new ErrorRecord(new Exception($"Upgrade of {instance.Name} aborted. ForwardErrorMessages parameter must be set to true or false because the configuration file has no setting for ForwardErrorMessages. This setting is mandatory as of version 1.12"), "UpgradeFailure", ErrorCategory.InvalidArgument, null));
}

if (!options.MaintenancePort.HasValue & !instance.AppConfig.AppSettingExists(SettingsList.DatabaseMaintenancePort.Name))
{
ThrowTerminatingError(new ErrorRecord(new Exception($"Upgrade of {instance.Name} aborted. DatabaseMaintenancePort parameter must be set to a value between 1 and 49151 because the configuration file has no setting for DatabaseMaintenancePort. This setting is mandatory as of version 2.0.0. If this is the only instance of ServiceControl, 33334 is the recommended value."), "UpgradeFailure", ErrorCategory.InvalidArgument, null));
}

if (!options.ErrorRetentionPeriod.HasValue & !instance.AppConfig.AppSettingExists(SettingsList.ErrorRetentionPeriod.Name))
{
ThrowTerminatingError(new ErrorRecord(new Exception($"Upgrade of {instance.Name} aborted. ErrorRetentionPeriod parameter must be set to timespan because the configuration file has no setting for ErrorRetentionPeriod. This setting is mandatory as of version 1.13"), "UpgradeFailure", ErrorCategory.InvalidArgument, null));
Expand Down