Skip to content

Commit c2a8e81

Browse files
author
Graeme Foster
committed
Check separately for machine not being removed from repository
1 parent 0487890 commit c2a8e81

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

AzureWebFarm.OctopusDeploy/Infrastructure/OctopusDeploy.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,29 @@ private void HandleFailedRemoval()
5353
{
5454
try
5555
{
56-
Log.Information("Detected existing tentacle.config - possible abrupt restart. Deleting tentacle.config.");
56+
Log.Information(
57+
"Detected existing tentacle.config - possible abrupt restart. Deleting tentacle.config.");
5758
File.Delete(Path.Combine(_tentacleInstallPath, "Tentacle.config"));
5859
Log.Information("Successfully removed tentacle.config from role.");
5960
}
6061
catch (Exception e)
6162
{
6263
Log.Error(e, "Failed to remove certificate from Octopus server. Manual intevention required.");
6364
}
65+
}
6466

67+
if (_repository.Machines.FindByName(_machineName) != null)
68+
{
6569
try
6670
{
67-
Log.Information("Attempting to remove tentacle from Octopus server.");
71+
Log.Information("Detected existing machine using this name. Attempting to remove tentacle from Octopus server.");
6872
DeleteMachine();
6973
Log.Information("Successfully removed tentacle from Octopus server.");
7074
}
7175
catch (Exception e)
7276
{
7377
Log.Error(e, "Failed to remove tentacle from Octopus server. Manual intevention required.");
7478
}
75-
7679
}
7780
}
7881

@@ -100,7 +103,7 @@ public void DeployAllCurrentReleasesToThisMachine()
100103
Comments = "Automated startup deployment by " + _machineName,
101104
EnvironmentId = currentRelease.EnvironmentId,
102105
ReleaseId = currentRelease.ReleaseId,
103-
SpecificMachineIds = new ReferenceCollection(new[] {machineId})
106+
SpecificMachineIds = new ReferenceCollection(new[] { machineId })
104107
}
105108
))
106109
.Select(d => d.TaskId)

0 commit comments

Comments
 (0)