Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
<PackageVersion Include="Particular.Approvals" Version="2.0.1" />
<PackageVersion Include="Particular.Licensing.Sources" Version="6.1.0" />
<PackageVersion Include="Particular.LicensingComponent.Report" Version="1.0.0" />
<PackageVersion Include="Particular.Obsoletes" Version="1.0.0" />
<PackageVersion Include="Polly.Core" Version="8.5.2" />
<PackageVersion Include="PropertyChanged.Fody" Version="4.1.0" />
<PackageVersion Include="PropertyChanging.Fody" Version="1.30.3" />
Expand Down
39 changes: 11 additions & 28 deletions src/ServiceControl.Config/Framework/Modules/InstallerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ internal async Task<ReportCard> Add(ServiceControlInstallableBase details, IProg
try
{
progress.Report(5, 9, "Registering URL ACLs...");
instanceInstaller.RegisterUrlAcl();
progress.Report(6, 9, "Instance setup in progress, this could take several minutes...");
instanceInstaller.SetupInstance();
}
Expand All @@ -87,10 +86,6 @@ internal async Task<ReportCard> Add(ServiceControlInstallableBase details, IProg
instanceInstaller.ReportCard.Warnings.Add($"New instance did not startup - please check configuration for {instance.Name}");
}
}
else
{
instanceInstaller.RemoveUrlAcl();
}

instanceInstaller.ReportCard.SetStatus();
return instanceInstaller.ReportCard;
Expand Down Expand Up @@ -193,7 +188,7 @@ internal async Task<ReportCard> Update(ServiceControlBaseService instance, bool
internal ReportCard Delete(string instanceName, bool removeDB, bool removeLogs, IProgress<ProgressDetails> progress = null)
{
progress ??= new Progress<ProgressDetails>();
progress.Report(0, 7, "Stopping instance...");
progress.Report(0, 6, "Stopping instance...");
var instance = InstanceFinder.FindServiceControlInstance(instanceName);
instance.ReportCard = new ReportCard();

Expand All @@ -208,27 +203,24 @@ internal ReportCard Delete(string instanceName, bool removeDB, bool removeLogs,

instance.BackupAppConfig();

progress.Report(1, 7, "Disabling startup...");
progress.Report(1, 6, "Disabling startup...");
instance.Service.SetStartupMode("Disabled");

progress.Report(2, 7, "Deleting service...");
progress.Report(2, 6, "Deleting service...");
instance.Service.Delete();

progress.Report(3, 7, "Removing URL ACL...");
instance.RemoveUrlAcl();

progress.Report(4, 7, "Deleting install...");
progress.Report(3, 6, "Deleting install...");
instance.RemoveBinFolder();

if (removeLogs)
{
progress.Report(5, 7, "Deleting logs...");
progress.Report(4, 6, "Deleting logs...");
instance.RemoveLogsFolder();
}

if (removeDB)
{
progress.Report(6, 7, "Deleting database...");
progress.Report(5, 6, "Deleting database...");
instance.RemoveDataBaseFolder();
}

Expand Down Expand Up @@ -268,8 +260,6 @@ internal async Task<ReportCard> Add(MonitoringNewInstance details, IProgress<Pro

try
{
progress.Report(5, 9, "Registering URL ACLs...");
instanceInstaller.RegisterUrlAcl();
progress.Report(6, 9, "Creating queues...");
instanceInstaller.SetupInstance();
}
Expand All @@ -290,10 +280,6 @@ internal async Task<ReportCard> Add(MonitoringNewInstance details, IProgress<Pro
instanceInstaller.ReportCard.Warnings.Add($"New instance did not startup - please check configuration for {instance.Name}");
}
}
else
{
instanceInstaller.RemoveUrlAcl();
}

instanceInstaller.ReportCard.SetStatus();
return instanceInstaller.ReportCard;
Expand Down Expand Up @@ -386,7 +372,7 @@ internal async Task<ReportCard> Update(MonitoringInstance instance, bool startSe
internal ReportCard Delete(string instanceName, bool removeLogs, IProgress<ProgressDetails> progress = null)
{
progress ??= new Progress<ProgressDetails>();
progress.Report(0, 7, "Stopping instance...");
progress.Report(0, 5, "Stopping instance...");
var instance = InstanceFinder.FindMonitoringInstance(instanceName);
instance.ReportCard = new ReportCard();

Expand All @@ -401,21 +387,18 @@ internal ReportCard Delete(string instanceName, bool removeLogs, IProgress<Progr

instance.BackupAppConfig();

progress.Report(1, 7, "Disabling startup...");
progress.Report(1, 5, "Disabling startup...");
instance.Service.SetStartupMode("Disabled");

progress.Report(2, 7, "Deleting service...");
progress.Report(2, 5, "Deleting service...");
instance.Service.Delete();

progress.Report(3, 7, "Removing URL ACL...");
instance.RemoveUrlAcl();

progress.Report(4, 7, "Deleting install...");
progress.Report(3, 5, "Deleting install...");
instance.RemoveBinFolder();

if (removeLogs)
{
progress.Report(5, 7, "Deleting logs...");
progress.Report(4, 5, "Deleting logs...");
instance.RemoveLogsFolder();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,18 @@
namespace ServiceControl.Management.PowerShell
{
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Security.Principal;
using ServiceControlInstaller.Engine.UrlAcl;
using Particular.Obsoletes;

[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http add urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http add urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
[Cmdlet(VerbsCommon.Add, "UrlAcl")]
public class AddUrlAcl : PSCmdlet
{
[ValidateNotNullOrEmpty]
[Parameter(Mandatory = true, Position = 0, HelpMessage = "The URL to add to the URLACL list. This should always in a trailing /")]

public string Url { get; set; }

protected override void BeginProcessing()
{
Account.TestIfAdmin();
}

protected override void ProcessRecord()
{
var sidList = new List<SecurityIdentifier>();

foreach (var user in Users)
{
try
{
var account = new NTAccount(user);
var sid = (SecurityIdentifier)account.Translate(typeof(SecurityIdentifier));
sidList.Add(sid);
}
catch (Exception ex)
{
WriteError(new ErrorRecord(ex, "Failed to parse account name", ErrorCategory.InvalidData, user));
return;
}
}

UrlReservation.Create(new UrlReservation(Url, sidList.ToArray()));
}

[ValidateNotNullOrEmpty]
[Parameter(Mandatory = true, Position = 1, HelpMessage = "The user or group to assign to this URLACL")]
public string[] Users;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
namespace ServiceControl.Management.PowerShell
{
using System;
using System.Management.Automation;
using ServiceControlInstaller.Engine.UrlAcl;
using Particular.Obsoletes;

[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http show urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http show urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
[Cmdlet(VerbsCommon.Get, "UrlAcls")]
public class GetUrlAcls : PSCmdlet
{
protected override void ProcessRecord()
{
WriteObject(UrlReservation.GetAll(), true);
}
}
public class GetUrlAcls : PSCmdlet;
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
namespace ServiceControl.Management.PowerShell
{
using System;
using System.Management.Automation;
using ServiceControlInstaller.Engine.UrlAcl;
using Particular.Obsoletes;

[ObsoleteMetadata(Message = "ServiceControl no longer requires URL reservations, so this command no longer functions", ReplacementTypeOrMember = "netsh http delete urlacl", TreatAsErrorFromVersion = "7", RemoveInVersion = "8")]
[Obsolete("ServiceControl no longer requires URL reservations, so this command no longer functions. Use 'netsh http delete urlacl' instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)]
[Cmdlet(VerbsCommon.Remove, "UrlAcl")]
public class RemoveUrlAcl : PSCmdlet
{
[ValidateNotNull]
[Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "Specify the URLACL to remove")]
public UrlReservation[] UrlAcl { get; set; }

protected override void BeginProcessing()
{
Account.TestIfAdmin();
}

protected override void ProcessRecord()
{
foreach (var entry in UrlAcl)
{
UrlReservation.Delete(entry);
}
}
}
public class RemoveUrlAcl : PSCmdlet;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<PackageReference Include="System.Management.Automation" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Particular.Obsoletes" PrivateAssets="All" ExcludeAssets="runtime" />
</ItemGroup>

<ItemGroup>
<Artifact Include="$(OutputPath)" DestinationFolder="$(PowerShellModuleArtifactsPath)" />
<Artifact Include="$(PkgMicrosoft_Extensions_DependencyModel)\lib\netstandard2.0\Microsoft.Extensions.DependencyModel.dll" DestinationFolder="$(PowerShellModuleArtifactsPath)" />
Expand Down
Loading