diff --git a/Directory.Build.props b/Directory.Build.props index cd8b427bc..af3e86e5a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -210,4 +210,18 @@ + + + + + + + + + + + + + + diff --git a/Tools/neon-cli/Commands/Cluster/ClusterDeleteCommand.cs b/Tools/neon-cli/Commands/Cluster/ClusterDeleteCommand.cs index 51537451f..c0b2387d1 100644 --- a/Tools/neon-cli/Commands/Cluster/ClusterDeleteCommand.cs +++ b/Tools/neon-cli/Commands/Cluster/ClusterDeleteCommand.cs @@ -205,6 +205,22 @@ private async Task RemoveCluster(ClusterProxy cluster, bool force) if (!force) { + var status = await cluster.GetClusterHealthAsync(); + + switch (status.State) + { + case ClusterState.Healthy: + case ClusterState.Unhealthy: + + break; + + default: + + Console.Error.WriteLine($"*** ERROR: Cluster is not running."); + Program.Exit(1); + break; + } + var isLocked = await cluster.IsLockedAsync(); if (!isLocked.HasValue) @@ -227,7 +243,7 @@ private async Task RemoveCluster(ClusterProxy cluster, bool force) try { - Console.WriteLine($"Removing: {cluster.Name}..."); + Console.WriteLine($"Deleting: {cluster.Name}..."); await cluster.DeleteClusterAsync(); // Remove all contexts that reference the cluster. @@ -240,7 +256,7 @@ private async Task RemoveCluster(ClusterProxy cluster, bool force) } KubeHelper.KubeConfig.Save(); - Console.WriteLine($"REMOVED: {cluster.Name}"); + Console.WriteLine($"Deleted: {cluster.Name}"); } catch (TimeoutException) { diff --git a/Tools/neon-cli/Commands/Cluster/ClusterLockCommand.cs b/Tools/neon-cli/Commands/Cluster/ClusterLockCommand.cs index 96d69f502..1e9c27a8b 100644 --- a/Tools/neon-cli/Commands/Cluster/ClusterLockCommand.cs +++ b/Tools/neon-cli/Commands/Cluster/ClusterLockCommand.cs @@ -114,7 +114,7 @@ public override async Task RunAsync(CommandLine commandLine) case ClusterState.Unhealthy: await cluster.LockAsync(); - Console.WriteLine($"{cluster.Name}: is LOCKED"); + Console.WriteLine($"{cluster.Name}: LOCKED"); break; default: diff --git a/Tools/neon-cli/Commands/Cluster/ClusterPauseCommand.cs b/Tools/neon-cli/Commands/Cluster/ClusterPauseCommand.cs index 27de37433..8632a4603 100644 --- a/Tools/neon-cli/Commands/Cluster/ClusterPauseCommand.cs +++ b/Tools/neon-cli/Commands/Cluster/ClusterPauseCommand.cs @@ -164,7 +164,7 @@ public override async Task RunAsync(CommandLine commandLine) try { await cluster.StopAsync(StopMode.Pause); - Console.WriteLine($"PAUSED: {cluster.Name}"); + Console.WriteLine($"Paused: {cluster.Name}"); } catch (TimeoutException) { diff --git a/Tools/neon-cli/Commands/Cluster/ClusterResetCommand.cs b/Tools/neon-cli/Commands/Cluster/ClusterResetCommand.cs index 8e2df3fa3..be7e7df07 100644 --- a/Tools/neon-cli/Commands/Cluster/ClusterResetCommand.cs +++ b/Tools/neon-cli/Commands/Cluster/ClusterResetCommand.cs @@ -244,7 +244,7 @@ await cluster.ResetAsync( }, progress: progressMessage => Console.WriteLine(progressMessage)); - Console.WriteLine($"RESET: {cluster.Name}"); + Console.WriteLine($"Reset: {cluster.Name}"); break; default: diff --git a/Tools/neon-cli/Commands/Cluster/ClusterStartCommand.cs b/Tools/neon-cli/Commands/Cluster/ClusterStartCommand.cs index 7a2ce74bf..fa7265e8b 100644 --- a/Tools/neon-cli/Commands/Cluster/ClusterStartCommand.cs +++ b/Tools/neon-cli/Commands/Cluster/ClusterStartCommand.cs @@ -118,7 +118,7 @@ public override async Task RunAsync(CommandLine commandLine) try { await cluster.StartAsync(); - Console.WriteLine($"STARTED: {cluster.Name}"); + Console.WriteLine($"Started: {cluster.Name}"); } catch (TimeoutException) { diff --git a/Tools/neon-cli/Commands/Cluster/ClusterStopCommand.cs b/Tools/neon-cli/Commands/Cluster/ClusterStopCommand.cs index fc0d822bb..1e76ec163 100644 --- a/Tools/neon-cli/Commands/Cluster/ClusterStopCommand.cs +++ b/Tools/neon-cli/Commands/Cluster/ClusterStopCommand.cs @@ -173,7 +173,7 @@ public override async Task RunAsync(CommandLine commandLine) } await cluster.StopAsync(turnoff ? StopMode.TurnOff : StopMode.Graceful); - Console.WriteLine($"STOPPED: {cluster.Name}"); + Console.WriteLine($"Stopped: {cluster.Name}"); } catch (TimeoutException) { diff --git a/Tools/neon-cli/Commands/Cluster/ClusterUnlockCommand.cs b/Tools/neon-cli/Commands/Cluster/ClusterUnlockCommand.cs index d0eb352f2..f0d4e6268 100644 --- a/Tools/neon-cli/Commands/Cluster/ClusterUnlockCommand.cs +++ b/Tools/neon-cli/Commands/Cluster/ClusterUnlockCommand.cs @@ -118,7 +118,7 @@ public override async Task RunAsync(CommandLine commandLine) case ClusterState.Unhealthy: await cluster.UnlockAsync(); - Console.WriteLine($"{cluster.Name}: is UNLOCKED"); + Console.WriteLine($"{cluster.Name}: UNLOCKED"); break; default: