From 322b1ee8c30c5d8905658be6cbd31311660b3562 Mon Sep 17 00:00:00 2001 From: Michael Noonan Date: Mon, 5 Jun 2017 21:40:20 +1000 Subject: [PATCH 1/6] Upgrade to latest shared nuget packages. --- .../Octopus.Manager.Tentacle.csproj | 8 ++++---- source/Octopus.Manager.Tentacle/packages.config | 4 ++-- .../Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj | 2 +- source/Octopus.Tentacle.Tests/packages.config | 2 +- source/Octopus.Tentacle/Octopus.Tentacle.csproj | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj b/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj index b9bfb91ec..eb660b2f1 100644 --- a/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj +++ b/source/Octopus.Manager.Tentacle/Octopus.Manager.Tentacle.csproj @@ -128,11 +128,11 @@ ..\packages\Octopus.Diagnostics.1.0.11\lib\netstandard1.0\Octopus.Diagnostics.dll True - - ..\packages\Octopus.Manager.Core.3.13.9-tentsplit0048\lib\Octopus.Manager.Core.dll + + ..\packages\Octopus.Manager.Core.3.14.1-enh-showdbupgrad0062\lib\Octopus.Manager.Core.dll - - ..\packages\Octopus.Shared.3.14.0-beta0005\lib\Octopus.Shared.dll + + ..\packages\Octopus.Shared.3.14.1-enh-showdbupgrad0062\lib\Octopus.Shared.dll ..\packages\Octopus.Time.1.0.8\lib\netstandard1.0\Octopus.Time.dll diff --git a/source/Octopus.Manager.Tentacle/packages.config b/source/Octopus.Manager.Tentacle/packages.config index a8a482c62..075ff7f8d 100644 --- a/source/Octopus.Manager.Tentacle/packages.config +++ b/source/Octopus.Manager.Tentacle/packages.config @@ -18,8 +18,8 @@ - - + + diff --git a/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj b/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj index 1b5d7667e..e3be9ad6f 100644 --- a/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj +++ b/source/Octopus.Tentacle.Tests/Octopus.Tentacle.Tests.csproj @@ -128,7 +128,7 @@ True - ..\packages\Octopus.Shared.3.14.1-enh-sha256-ui0002\lib\Octopus.Shared.dll + ..\packages\Octopus.Shared.3.14.1-enh-showdbupgrad0062\lib\Octopus.Shared.dll ..\packages\Octopus.Time.1.0.8\lib\netstandard1.0\Octopus.Time.dll diff --git a/source/Octopus.Tentacle.Tests/packages.config b/source/Octopus.Tentacle.Tests/packages.config index c7ab581ce..92f85645e 100644 --- a/source/Octopus.Tentacle.Tests/packages.config +++ b/source/Octopus.Tentacle.Tests/packages.config @@ -42,7 +42,7 @@ - + diff --git a/source/Octopus.Tentacle/Octopus.Tentacle.csproj b/source/Octopus.Tentacle/Octopus.Tentacle.csproj index ddd45d660..c4f700a08 100644 --- a/source/Octopus.Tentacle/Octopus.Tentacle.csproj +++ b/source/Octopus.Tentacle/Octopus.Tentacle.csproj @@ -16,7 +16,7 @@ - + From de089f48002a3d730e8637a9dc02e02460b5b395 Mon Sep 17 00:00:00 2001 From: Michael Noonan Date: Mon, 5 Jun 2017 21:41:19 +1000 Subject: [PATCH 2/6] Can't call abstract method... base class changed --- source/Octopus.Tentacle/Commands/ConfigureCommand.cs | 2 -- source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs | 1 - source/Octopus.Tentacle/Commands/ImportCertificateCommand.cs | 2 -- source/Octopus.Tentacle/Commands/NewCertificateCommand.cs | 2 -- source/Octopus.Tentacle/Commands/PollCommand.cs | 1 - source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs | 1 - source/Octopus.Tentacle/Commands/RunAgentCommand.cs | 2 -- source/Octopus.Tentacle/Commands/ServerCommsCommand.cs | 2 -- source/Octopus.Tentacle/Commands/ShowThumbprintCommand.cs | 1 - 9 files changed, 14 deletions(-) diff --git a/source/Octopus.Tentacle/Commands/ConfigureCommand.cs b/source/Octopus.Tentacle/Commands/ConfigureCommand.cs index ac86b04a1..99cb4ba69 100644 --- a/source/Octopus.Tentacle/Commands/ConfigureCommand.cs +++ b/source/Octopus.Tentacle/Commands/ConfigureCommand.cs @@ -83,8 +83,6 @@ public ConfigureCommand( protected override void Start() { - base.Start(); - if (resetTrust) { log.Info("Removing all trusted Octopus servers..."); diff --git a/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs b/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs index fa3d57f9c..84ce7890b 100644 --- a/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs +++ b/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs @@ -35,7 +35,6 @@ public DeregisterMachineCommand(Lazy configuration, ILog protected override void Start() { - base.Start(); StartAsync().GetAwaiter().GetResult(); } diff --git a/source/Octopus.Tentacle/Commands/ImportCertificateCommand.cs b/source/Octopus.Tentacle/Commands/ImportCertificateCommand.cs index 96a950f7e..224fac4ee 100644 --- a/source/Octopus.Tentacle/Commands/ImportCertificateCommand.cs +++ b/source/Octopus.Tentacle/Commands/ImportCertificateCommand.cs @@ -33,8 +33,6 @@ public ImportCertificateCommand(Lazy tentacleConfigurati protected override void Start() { - base.Start(); - if (!fromRegistry && string.IsNullOrWhiteSpace(importFile)) throw new ArgumentException("Please specify the certificate to import."); diff --git a/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs b/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs index bee4568aa..ed8582ab6 100644 --- a/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs +++ b/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs @@ -48,8 +48,6 @@ protected override void Start() } else { - base.Start(); // Initialises Tentacle Instance. This is only required when pushing to config. - if (preserve && configuration.Value.TentacleCertificate != null) { log.Info("A certificate already exists, no changes will be applied."); diff --git a/source/Octopus.Tentacle/Commands/PollCommand.cs b/source/Octopus.Tentacle/Commands/PollCommand.cs index 30e279dbd..3f03359cb 100644 --- a/source/Octopus.Tentacle/Commands/PollCommand.cs +++ b/source/Octopus.Tentacle/Commands/PollCommand.cs @@ -40,7 +40,6 @@ public PollCommand(Lazy configuration, ILog log, IApplic protected override void Start() { - base.Start(); StartAsync().GetAwaiter().GetResult(); } diff --git a/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs b/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs index 27f1c449e..59e142ec7 100644 --- a/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs +++ b/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs @@ -67,7 +67,6 @@ public RegisterMachineCommand(Lazy lazyRegisterMachin protected override void Start() { - base.Start(); StartAsync().GetAwaiter().GetResult(); } diff --git a/source/Octopus.Tentacle/Commands/RunAgentCommand.cs b/source/Octopus.Tentacle/Commands/RunAgentCommand.cs index 1db9ef917..4d8ee0114 100644 --- a/source/Octopus.Tentacle/Commands/RunAgentCommand.cs +++ b/source/Octopus.Tentacle/Commands/RunAgentCommand.cs @@ -51,8 +51,6 @@ public RunAgentCommand( protected override void Start() { - base.Start(); - if (wait >= 20) { log.Info("Sleeping for " + wait + "ms..."); diff --git a/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs b/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs index 51b51aeb4..565dad979 100644 --- a/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs +++ b/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs @@ -35,8 +35,6 @@ public ServerCommsCommand(Lazy tentacleConfiguration, IL protected override void Start() { - base.Start(); - if (!tentacleConfiguration.Value.TrustedOctopusThumbprints.Any()) throw new ArgumentException("Before server communications can be modified, trust must be established with the configure command"); diff --git a/source/Octopus.Tentacle/Commands/ShowThumbprintCommand.cs b/source/Octopus.Tentacle/Commands/ShowThumbprintCommand.cs index 80e41d1f5..735ce3292 100644 --- a/source/Octopus.Tentacle/Commands/ShowThumbprintCommand.cs +++ b/source/Octopus.Tentacle/Commands/ShowThumbprintCommand.cs @@ -26,7 +26,6 @@ public ShowThumbprintCommand(Lazy tentacleConfiguration, protected override void Start() { - base.Start(); var thumbprint = tentacleConfiguration.Value.TentacleCertificate.Thumbprint; log.Info((thumbprintOnly ? "" : "The thumbprint of this Tentacle is: ") + thumbprint); if (!string.IsNullOrWhiteSpace(exportFile)) From 3690263843a51e4899a2a10dc3dc44ed12c05aa2 Mon Sep 17 00:00:00 2001 From: Michael Noonan Date: Mon, 5 Jun 2017 21:42:05 +1000 Subject: [PATCH 3/6] Update to match the new API This allows the logs folder to be opened if a command fails. --- source/Octopus.Manager.Tentacle/App.xaml.cs | 6 ++++-- .../TentacleManager/TentacleManagerView.xaml.cs | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/Octopus.Manager.Tentacle/App.xaml.cs b/source/Octopus.Manager.Tentacle/App.xaml.cs index 998118e5d..2bdf703ce 100644 --- a/source/Octopus.Manager.Tentacle/App.xaml.cs +++ b/source/Octopus.Manager.Tentacle/App.xaml.cs @@ -12,6 +12,7 @@ using Octopus.Manager.Core.Shared.Shell; using Octopus.Manager.Core.Util; using Octopus.Manager.Tentacle.TentacleConfiguration; +using Octopus.Manager.Tentacle.TentacleConfiguration.TentacleManager; using Octopus.Shared.Configuration; using Octopus.Shared.Diagnostics; using Octopus.Shared.Internals.Options; @@ -91,10 +92,11 @@ void ReconfigureTentacleService(IApplicationInstanceStore applicationInstanceSto var instancesWithDefaultFirst = defaultInstance.Concat(instances.Except(defaultInstance).OrderBy(x => x.InstanceName)); foreach (var instance in instancesWithDefaultFirst) { - var service = new ServiceWatcher(instance.ApplicationName, instance.InstanceName, CommandLine.PathToTentacleExe()); + var model = new TentacleManagerModel(); + model.Load(instance); var isDefaultInstance = instance.InstanceName == ApplicationInstanceRecord.GetDefaultInstance(instance.ApplicationName); var title = isDefaultInstance ? "Reconfiguring Tentacle..." : $"Reconfiguring Tentacle {instance.InstanceName}..."; - RunProcessDialog.ShowDialog(MainWindow, service.GetReconfigureCommands(), title); + RunProcessDialog.ShowDialog(MainWindow, model.ServiceWatcher.GetReconfigureCommands(), title, model.LogsDirectory); } } diff --git a/source/Octopus.Manager.Tentacle/TentacleConfiguration/TentacleManager/TentacleManagerView.xaml.cs b/source/Octopus.Manager.Tentacle/TentacleConfiguration/TentacleManager/TentacleManagerView.xaml.cs index daf78e913..cde780852 100644 --- a/source/Octopus.Manager.Tentacle/TentacleConfiguration/TentacleManager/TentacleManagerView.xaml.cs +++ b/source/Octopus.Manager.Tentacle/TentacleConfiguration/TentacleManager/TentacleManagerView.xaml.cs @@ -83,24 +83,24 @@ void SetupTentacle(object sender, RoutedEventArgs e) void StartServiceClicked(object sender, EventArgs e) { - RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetStartCommands(), "Starting Tentacle service..."); + RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetStartCommands(), "Starting Tentacle service...", model.LogsDirectory); } void StopServiceClicked(object sender, EventArgs e) { - RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetStopCommands(), "Stopping Tentacle service..."); + RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetStopCommands(), "Stopping Tentacle service...", model.LogsDirectory); Refresh(); } void RestartServiceClicked(object sender, EventArgs e) { - RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetRestartCommands(), "Restarting Tentacle service..."); + RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetRestartCommands(), "Restarting Tentacle service...", model.LogsDirectory); Refresh(); } void RepairServiceClicked(object sender, EventArgs e) { - RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetRepairCommands(), "Reinstalling the Tentacle service..."); + RunProcessDialog.ShowDialog(Window.GetWindow(this), model.ServiceWatcher.GetRepairCommands(), "Reinstalling the Tentacle service...", model.LogsDirectory); } void ShowProxy(object sender, EventArgs e) From eef82ef47c93df34e11b0727a5cd8e5611a24433 Mon Sep 17 00:00:00 2001 From: Michael Noonan Date: Mon, 5 Jun 2017 21:42:51 +1000 Subject: [PATCH 4/6] No more special treatment for ArgumentException Historically, we've used ArgumentException to report command argument validation problems, and ignore the stack trace. If an "unexpected" ArgumentException is thrown, we lose all the stack trace information. We should actually use a special exception like ControlledFailureException to achieve the same result, and allow ArgumentExceptions from other places to flow unencumbered. --- .../Commands/DeregisterMachineCommandFixture.cs | 3 ++- .../Commands/ServerCommsCommandTest.cs | 5 +++-- .../Commands/DeregisterMachineCommand.cs | 5 +++-- .../Octopus.Tentacle/Commands/ExtractCommand.cs | 3 ++- .../Commands/ImportCertificateCommand.cs | 7 ++++--- .../Commands/NewCertificateCommand.cs | 3 ++- source/Octopus.Tentacle/Commands/PollCommand.cs | 3 ++- .../Commands/RegisterMachineCommand.cs | 8 ++++---- .../Commands/ServerCommsCommand.cs | 15 ++++++++------- 9 files changed, 30 insertions(+), 22 deletions(-) diff --git a/source/Octopus.Tentacle.Tests/Commands/DeregisterMachineCommandFixture.cs b/source/Octopus.Tentacle.Tests/Commands/DeregisterMachineCommandFixture.cs index 4a372daf4..c50f4d033 100644 --- a/source/Octopus.Tentacle.Tests/Commands/DeregisterMachineCommandFixture.cs +++ b/source/Octopus.Tentacle.Tests/Commands/DeregisterMachineCommandFixture.cs @@ -6,6 +6,7 @@ using Octopus.Client; using Octopus.Client.Model; using Octopus.Diagnostics; +using Octopus.Shared; using Octopus.Shared.Configuration; using Octopus.Shared.Security; using Octopus.Tentacle.Commands; @@ -50,7 +51,7 @@ public async Task ShouldNotContinueIfMultipleMatchesButAllowMultipleIsNotSupplie asyncRepository.Machines.FindByThumbprint(Arg.Any()) .ReturnsForAnyArgs(matchingMachines.AsTask()); - var result = Assert.Throws( async () => await Command.Deregister(asyncRepository)); + var result = Assert.Throws( async () => await Command.Deregister(asyncRepository)); Assert.That(result.Message.Equals(DeregisterMachineCommand.MultipleMatchErrorMsg)); } diff --git a/source/Octopus.Tentacle.Tests/Commands/ServerCommsCommandTest.cs b/source/Octopus.Tentacle.Tests/Commands/ServerCommsCommandTest.cs index 227f8c18a..bec9f52c2 100644 --- a/source/Octopus.Tentacle.Tests/Commands/ServerCommsCommandTest.cs +++ b/source/Octopus.Tentacle.Tests/Commands/ServerCommsCommandTest.cs @@ -5,6 +5,7 @@ using NSubstitute; using NUnit.Framework; using Octopus.Client.Model; +using Octopus.Shared; using Octopus.Shared.Configuration; using Octopus.Shared.Internals.Options; using Octopus.Shared.Startup; @@ -78,7 +79,7 @@ static void Assert(OctopusServerConfiguration server, string thumbprint, Communi public void NoTrusts() { Action action = () => Execute(Thumb1, CommunicationStyle.TentaclePassive); - action.ShouldThrow() + action.ShouldThrow() .WithMessage("Before server communications can be modified, trust must be established with the configure command"); } @@ -98,7 +99,7 @@ public void AddActiveNoHost() { AddTrusts(Thumb1); Action action = () => Execute(Thumb1, CommunicationStyle.TentacleActive, null, "1234"); - action.ShouldThrow() + action.ShouldThrow() .WithMessage("Please provide either the server hostname or websocket address, e.g. --host=OCTOPUS"); } diff --git a/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs b/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs index 84ce7890b..4daf39344 100644 --- a/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs +++ b/source/Octopus.Tentacle/Commands/DeregisterMachineCommand.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using Octopus.Diagnostics; using Octopus.Client; +using Octopus.Shared; using Octopus.Shared.Configuration; using Octopus.Shared.Startup; using Octopus.Tentacle.Commands.OptionSets; @@ -54,10 +55,10 @@ public async Task Deregister(IOctopusAsyncRepository repository) var matchingMachines = await repository.Machines.FindByThumbprint(configuration.Value.TentacleCertificate.Thumbprint); if (matchingMachines.Count == 0) - throw new ArgumentException("No machine was found on the server matching this Tentacle's thumbprint."); + throw new ControlledFailureException("No machine was found on the server matching this Tentacle's thumbprint."); if (matchingMachines.Count > 1 && !allowMultiple) - throw new ArgumentException(MultipleMatchErrorMsg); + throw new ControlledFailureException(MultipleMatchErrorMsg); // 2. contact the server and de-register, this is independant to any tentacle configuration foreach (var machineResource in matchingMachines) diff --git a/source/Octopus.Tentacle/Commands/ExtractCommand.cs b/source/Octopus.Tentacle/Commands/ExtractCommand.cs index 69415351d..a48169f94 100644 --- a/source/Octopus.Tentacle/Commands/ExtractCommand.cs +++ b/source/Octopus.Tentacle/Commands/ExtractCommand.cs @@ -6,6 +6,7 @@ using Octopus.Shared.Util; using System.Threading; using Octopus.Diagnostics; +using Octopus.Shared; namespace Octopus.Tentacle.Commands { @@ -24,7 +25,7 @@ public ExtractCommand(Lazy packageInstaller, Lazy tentacleConfigurati protected override void Start() { if (!fromRegistry && string.IsNullOrWhiteSpace(importFile)) - throw new ArgumentException("Please specify the certificate to import."); + throw new ControlledFailureException("Please specify the certificate to import."); if (fromRegistry && !string.IsNullOrWhiteSpace(importFile)) - throw new ArgumentException("Please specify only one of either from-registry or from-file."); + throw new ControlledFailureException("Please specify only one of either from-registry or from-file."); X509Certificate2 x509Certificate = null; if (fromRegistry) @@ -47,7 +48,7 @@ protected override void Start() string encoded = GetEncodedCertificate(); if (string.IsNullOrWhiteSpace(encoded)) { - throw new ArgumentException("No Octopus 1.x Tentacle certificate was found."); + throw new ControlledFailureException("No Octopus 1.x Tentacle certificate was found."); } x509Certificate = CertificateEncoder.FromBase64String(encoded); } diff --git a/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs b/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs index ed8582ab6..16b6e7f1e 100644 --- a/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs +++ b/source/Octopus.Tentacle/Commands/NewCertificateCommand.cs @@ -2,6 +2,7 @@ using System.IO; using System.Text; using Octopus.Diagnostics; +using Octopus.Shared; using Octopus.Shared.Configuration; using Octopus.Shared.Security; using Octopus.Shared.Security.Certificates; @@ -36,7 +37,7 @@ protected override void Start() { if (preserve && !string.IsNullOrWhiteSpace(exportFile)) - throw new ArgumentException("Invalid command: --if-blank and --export-file cannot be specified together"); + throw new ControlledFailureException("Invalid command: --if-blank and --export-file cannot be specified together"); if (!string.IsNullOrWhiteSpace(exportFile)) { diff --git a/source/Octopus.Tentacle/Commands/PollCommand.cs b/source/Octopus.Tentacle/Commands/PollCommand.cs index 3f03359cb..dc8a553d6 100644 --- a/source/Octopus.Tentacle/Commands/PollCommand.cs +++ b/source/Octopus.Tentacle/Commands/PollCommand.cs @@ -6,6 +6,7 @@ using Octopus.Client.Model; using Octopus.Client.Model.Endpoints; using Octopus.Diagnostics; +using Octopus.Shared; using Octopus.Shared.Configuration; using Octopus.Shared.Startup; using Octopus.Tentacle.Commands.OptionSets; @@ -140,7 +141,7 @@ Uri GetAddress() case "wss": break; default: - throw new ArgumentException("The websocket address must start with wss://"); + throw new ControlledFailureException("The websocket address must start with wss://"); } return address; diff --git a/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs b/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs index 59e142ec7..f7f5c5ae1 100644 --- a/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs +++ b/source/Octopus.Tentacle/Commands/RegisterMachineCommand.cs @@ -73,14 +73,14 @@ protected override void Start() async Task StartAsync() { if (environmentNames.Count == 0 || string.IsNullOrWhiteSpace(environmentNames.First())) - throw new ArgumentException("Please specify an environment name, e.g., --environment=Development"); + throw new ControlledFailureException("Please specify an environment name, e.g., --environment=Development"); CommunicationStyle communicationStyle; if (!Enum.TryParse(comms, true, out communicationStyle)) - throw new ArgumentException("Please specify a valid communications style, e.g. --comms-style=TentaclePassive"); + throw new ControlledFailureException("Please specify a valid communications style, e.g. --comms-style=TentaclePassive"); if (configuration.Value.TentacleCertificate == null) - throw new ArgumentException("No certificate has been generated for this Tentacle. Please run the new-certificate command first."); + throw new ControlledFailureException("No certificate has been generated for this Tentacle. Please run the new-certificate command first."); Uri serverAddress = null; @@ -169,7 +169,7 @@ Uri GetActiveTentacleAddress() case "wss": break; default: - throw new ArgumentException("The websocket address must start with wss://"); + throw new ControlledFailureException("The websocket address must start with wss://"); } return address; diff --git a/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs b/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs index 565dad979..753bd2c24 100644 --- a/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs +++ b/source/Octopus.Tentacle/Commands/ServerCommsCommand.cs @@ -3,6 +3,7 @@ using Halibut; using Octopus.Client.Model; using Octopus.Diagnostics; +using Octopus.Shared; using Octopus.Shared.Configuration; using Octopus.Shared.Startup; using Octopus.Shared.Util; @@ -36,23 +37,23 @@ public ServerCommsCommand(Lazy tentacleConfiguration, IL protected override void Start() { if (!tentacleConfiguration.Value.TrustedOctopusThumbprints.Any()) - throw new ArgumentException("Before server communications can be modified, trust must be established with the configure command"); + throw new ControlledFailureException("Before server communications can be modified, trust must be established with the configure command"); if (string.IsNullOrWhiteSpace(serverThumbprint)) { if (tentacleConfiguration.Value.TrustedOctopusThumbprints.Count() != 1) - throw new ArgumentException("More than one server is trusted; please provide the thumbprint of the server to configure, e.g. --thumbprint=..."); + throw new ControlledFailureException("More than one server is trusted; please provide the thumbprint of the server to configure, e.g. --thumbprint=..."); serverThumbprint = tentacleConfiguration.Value.TrustedOctopusThumbprints.Single(); } CommunicationStyle communicationStyle; if (!Enum.TryParse(style, true, out communicationStyle)) - throw new ArgumentException("Please specify a valid communications style, e.g. --style=TentaclePassive"); + throw new ControlledFailureException("Please specify a valid communications style, e.g. --style=TentaclePassive"); var servers = tentacleConfiguration.Value.TrustedOctopusServers.Where(s => s.Thumbprint == serverThumbprint).ToArray(); if (servers.None()) - throw new ArgumentException("No trusted server was found with the supplied thumbprint"); + throw new ControlledFailureException("No trusted server was found with the supplied thumbprint"); if (communicationStyle == CommunicationStyle.TentacleActive) @@ -93,10 +94,10 @@ Uri GetActiveAddress() var hasHost = !string.IsNullOrWhiteSpace(serverHost); var hasWebSocket = !string.IsNullOrWhiteSpace(webSocket); if (!hasHost && !hasWebSocket) - throw new ArgumentException("Please provide either the server hostname or websocket address, e.g. --host=OCTOPUS"); + throw new ControlledFailureException("Please provide either the server hostname or websocket address, e.g. --host=OCTOPUS"); if (hasHost && hasWebSocket) - throw new ArgumentException("The hostname and websocket options cannot be used together"); + throw new ControlledFailureException("The hostname and websocket options cannot be used together"); if (hasHost) return new Uri($"https://{serverHost}:{serverPort}"); @@ -111,7 +112,7 @@ Uri GetActiveAddress() case "wss": break; default: - throw new ArgumentException("The websocket address must start with wss://"); + throw new ControlledFailureException("The websocket address must start with wss://"); } return address; From 12f2fb49856514ea4c1f9cd11835029ca8d07258 Mon Sep 17 00:00:00 2001 From: Michael Noonan Date: Mon, 5 Jun 2017 21:43:30 +1000 Subject: [PATCH 5/6] Use new commands to initialize Tentacle Recent changes means the home directory does not need to be configured separately to creating the instance. --- .../SetupWizard/TentacleSetupWizardModel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs b/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs index ff9970dbc..1fa98da86 100644 --- a/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs +++ b/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs @@ -600,7 +600,6 @@ public IEnumerable GenerateScript() yield return Cli("configure").Flag("reset-trust").Build(); var config = Cli("configure") - .Argument("home", root) .Argument("app", applicationInstallDirectory) .Argument("port", ListenPort) .Argument("noListen", IsTentacleActive.ToString()); From 936d4cb5519a76f0a9d7d145cb2b3a27c3df29ab Mon Sep 17 00:00:00 2001 From: Michael Noonan Date: Tue, 6 Jun 2017 08:53:26 +1000 Subject: [PATCH 6/6] Home directory is set same as the config path --- .../SetupWizard/TentacleSetupWizardModel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs b/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs index 1fa98da86..57c2ca34a 100644 --- a/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs +++ b/source/Octopus.Manager.Tentacle/TentacleConfiguration/SetupWizard/TentacleSetupWizardModel.cs @@ -592,7 +592,6 @@ string[] SelectedTenantsArray public IEnumerable GenerateScript() { - var root = Path.GetFullPath(HomeDirectory); pathToConfig = Path.Combine(HomeDirectory, ((ApplicationInstanceRecord.GetDefaultInstance(applicationName) != InstanceName) ? "Tentacle-" + InstanceName : InstanceName) + ".config"); yield return Cli("create-instance").Argument("config", pathToConfig).Build();