Skip to content

Commit 9888c42

Browse files
Merge pull request #2476 from Particular/urlacl-fixes
Adding aclurl for all hostnames for the maintenance mode
2 parents 9ea236c + ad8eea6 commit 9888c42

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

src/ServiceControlInstaller.Engine/Instances/ServiceControlBaseService.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public string AclMaintenanceUrl
7070
{
7171
get
7272
{
73-
var baseUrl = $"http://{HostName}:{DatabaseMaintenancePort}/";
73+
var baseUrl = $"http://+:{DatabaseMaintenancePort}/";
7474
return baseUrl;
7575
}
7676
}
@@ -208,8 +208,17 @@ protected string DefaultLogPath()
208208

209209
public void RemoveUrlAcl()
210210
{
211-
foreach (var urlReservation in UrlReservation.GetAll().Where(p => p.Url.StartsWith(AclUrl, StringComparison.OrdinalIgnoreCase) ||
212-
p.Url.StartsWith(AclMaintenanceUrl, StringComparison.OrdinalIgnoreCase)))
211+
//This is an old aclurl registration for embedded RavenDB instance that includes the hostname.
212+
//We need that to make sure we can clean-up old registration when removing instances created
213+
//using pre 4.17 versions of ServiceControl.
214+
var legacyAclMaintenanceUrl = $"http://{HostName}:{DatabaseMaintenancePort}/";
215+
216+
bool IsServiceControlAclUrl(UrlReservation r) =>
217+
r.Url.StartsWith(AclUrl, StringComparison.OrdinalIgnoreCase) ||
218+
r.Url.StartsWith(AclMaintenanceUrl, StringComparison.OrdinalIgnoreCase) ||
219+
r.Url.StartsWith(legacyAclMaintenanceUrl, StringComparison.OrdinalIgnoreCase);
220+
221+
foreach (var urlReservation in UrlReservation.GetAll().Where(IsServiceControlAclUrl))
213222
{
214223
try
215224
{

src/ServiceControlInstaller.Engine/Instances/ServiceControlNewInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public string AclMaintenanceUrl
225225
{
226226
get
227227
{
228-
var baseUrl = $"http://{HostName}:{DatabaseMaintenancePort}/";
228+
var baseUrl = $"http://+:{DatabaseMaintenancePort}/";
229229
return baseUrl;
230230
}
231231
}

src/ServiceControlInstaller.PowerShell/Cmdlets/AuditInstances/NewServiceControlAuditInstance.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace ServiceControlInstaller.PowerShell
22
{
33
using System;
4-
using System.IO;
54
using System.Linq;
65
using System.Management.Automation;
76
using Engine.Instances;

0 commit comments

Comments
 (0)