Skip to content

Commit 1398007

Browse files
author
Graeme Foster
committed
Trying to be more forceful when roles don't recycle nicely
1 parent 6c27ff9 commit 1398007

File tree

7 files changed

+43
-10
lines changed

7 files changed

+43
-10
lines changed

AzureWebFarm.OctopusDeploy.Tests/AzureWebFarm.OctopusDeploy.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
<SpecificVersion>False</SpecificVersion>
6161
<HintPath>..\packages\NSubstitute.1.7.2.0\lib\NET45\NSubstitute.dll</HintPath>
6262
</Reference>
63-
<Reference Include="Octopus.Client, Version=3.2.0.0, Culture=neutral, processorArchitecture=MSIL">
64-
<HintPath>..\packages\Octopus.Client.3.2.0\lib\net40\Octopus.Client.dll</HintPath>
63+
<Reference Include="Octopus.Client, Version=3.2.1.0, Culture=neutral, processorArchitecture=MSIL">
64+
<HintPath>..\packages\Octopus.Client.3.2.1\lib\net40\Octopus.Client.dll</HintPath>
6565
<Private>True</Private>
6666
</Reference>
6767
<Reference Include="Shouldly">

AzureWebFarm.OctopusDeploy.Tests/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<package id="Microsoft.Web.Xdt" version="1.0.0" targetFramework="net45" />
88
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
99
<package id="NSubstitute" version="1.7.2.0" targetFramework="net45" />
10-
<package id="Octopus.Client" version="3.2.0" targetFramework="net45" />
10+
<package id="Octopus.Client" version="3.2.1" targetFramework="net45" />
1111
<package id="Shouldly" version="1.1.1.1" targetFramework="net45" />
1212
<package id="xunit" version="1.9.2" targetFramework="net45" />
1313
<package id="xunit.extensions" version="1.9.2" targetFramework="net45" />

AzureWebFarm.OctopusDeploy/AzureWebFarm.OctopusDeploy.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
6060
<Private>True</Private>
6161
</Reference>
62-
<Reference Include="Octopus.Client, Version=3.2.0.0, Culture=neutral, processorArchitecture=MSIL">
63-
<HintPath>..\packages\Octopus.Client.3.2.0\lib\net40\Octopus.Client.dll</HintPath>
62+
<Reference Include="Octopus.Client, Version=3.2.1.0, Culture=neutral, processorArchitecture=MSIL">
63+
<HintPath>..\packages\Octopus.Client.3.2.1\lib\net40\Octopus.Client.dll</HintPath>
6464
<Private>True</Private>
6565
</Reference>
6666
<Reference Include="Serilog, Version=1.2.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">

AzureWebFarm.OctopusDeploy/Infrastructure/OctopusDeploy.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public void ConfigureTentacle()
3737
{
3838
var tentacleDeploymentsPath = _config.TentacleDeploymentsPath;
3939

40+
HandleFailedRemoval();
41+
4042
_processRunner.Run(_tentaclePath, string.Format("create-instance {0} --config \"{1}\" --console", InstanceArg, Path.Combine(_tentacleInstallPath, "Tentacle.config")));
4143
_processRunner.Run(_tentaclePath, string.Format("new-certificate {0} --console", InstanceArg));
4244
_processRunner.Run(_tentaclePath, string.Format("configure {0} --home \"{1}\" --console", InstanceArg, tentacleDeploymentsPath.Substring(0, tentacleDeploymentsPath.Length - 1)));
@@ -45,6 +47,35 @@ public void ConfigureTentacle()
4547
_processRunner.Run(_tentaclePath, string.Format("service {0} --install --start --console", InstanceArg));
4648
}
4749

50+
private void HandleFailedRemoval()
51+
{
52+
if (File.Exists(Path.Combine(_tentacleInstallPath, "Tentacle.config")))
53+
{
54+
try
55+
{
56+
Log.Information("Detected existing tentacle.config - possible abrupt restart. Deleting tentacle.config.");
57+
File.Delete(Path.Combine(_tentacleInstallPath, "Tentacle.config"));
58+
Log.Information("Successfully removed tentacle.config from role.");
59+
}
60+
catch (Exception e)
61+
{
62+
Log.Error(e, "Failed to remove certificate from Octopus server. Manual intevention required.");
63+
}
64+
65+
try
66+
{
67+
Log.Information("Attempting to remove tentacle from Octopus server.");
68+
DeleteMachine();
69+
Log.Information("Successfully removed tentacle from Octopus server.");
70+
}
71+
catch (Exception e)
72+
{
73+
Log.Error(e, "Failed to remove tentacle from Octopus server. Manual intevention required.");
74+
}
75+
76+
}
77+
}
78+
4879
public void DeleteMachine()
4980
{
5081
var machine = _repository.Machines.FindByName(_machineName);

AzureWebFarm.OctopusDeploy/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<package id="Microsoft.Web.Administration" version="7.0.0.0" targetFramework="net45" />
66
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
77
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
8-
<package id="Octopus.Client" version="3.2.0" targetFramework="net45" />
8+
<package id="Octopus.Client" version="3.2.1" targetFramework="net45" />
99
<package id="Serilog" version="1.2.25" targetFramework="net45" />
1010
<package id="Serilog.Sinks.AzureTableStorage" version="1.2.25" targetFramework="net45" />
1111
<package id="System.Spatial" version="5.2.0" targetFramework="net45" />

ExampleWebFarm/ExampleWebFarm.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
7070
<Private>True</Private>
7171
</Reference>
72-
<Reference Include="Octopus.Client, Version=3.2.0.0, Culture=neutral, processorArchitecture=MSIL">
73-
<HintPath>..\packages\Octopus.Client.3.2.0\lib\net40\Octopus.Client.dll</HintPath>
72+
<Reference Include="Octopus.Client, Version=3.2.1.0, Culture=neutral, processorArchitecture=MSIL">
73+
<HintPath>..\packages\Octopus.Client.3.2.1\lib\net40\Octopus.Client.dll</HintPath>
7474
<Private>True</Private>
7575
</Reference>
7676
<Reference Include="Serilog, Version=1.2.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
@@ -105,7 +105,9 @@
105105
<ItemGroup>
106106
<Content Include="Default.aspx" />
107107
<Content Include="Global.asax" />
108-
<Content Include="Web.config" />
108+
<Content Include="Web.config">
109+
<SubType>Designer</SubType>
110+
</Content>
109111
</ItemGroup>
110112
<ItemGroup>
111113
<Content Include="packages.config">

ExampleWebFarm/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<package id="Microsoft.Web.Administration" version="7.0.0.0" targetFramework="net45" />
66
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.3" targetFramework="net45" />
77
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
8-
<package id="Octopus.Client" version="3.2.0" targetFramework="net45" />
8+
<package id="Octopus.Client" version="3.2.1" targetFramework="net45" />
99
<package id="Serilog" version="1.2.25" targetFramework="net45" />
1010
<package id="Serilog.Sinks.AzureTableStorage" version="1.2.25" targetFramework="net45" />
1111
<package id="System.Spatial" version="5.2.0" targetFramework="net45" />

0 commit comments

Comments
 (0)