# HG changeset patch # User Brad Greco # Date 1559511937 14400 # Node ID b5502ce8cb1f6e56480cfb1db4bbfddaffc45fc3 # Parent 781d8b980be1a61b6b76a4fc2d7c79b14c348421 Fix servers getting disabled at program launch if no SSH key is set, even if they have no SSH checks. diff -r 781d8b980be1 -r b5502ce8cb1f ServerMonitor/Objects/Server.cs --- a/ServerMonitor/Objects/Server.cs Thu May 30 21:41:14 2019 -0400 +++ b/ServerMonitor/Objects/Server.cs Sun Jun 02 17:45:37 2019 -0400 @@ -111,7 +111,8 @@ // Disable the server until the user enters the decryption key, // and set the KeyStatus to indicate why the server was disabled. KeyStatus = KeyStatus.Closed; - Enabled = false; + if (HasSshChecks) + Enabled = false; } else { @@ -139,7 +140,7 @@ // Do not allow enabling the server if the private key is not accessible. // Do not fire the EnabledChanged event if the Enabled state is not actually changing // from its existing value. - if ((LoginType == LoginType.PrivateKey && PrivateKeyFile == null && value == true && Checks.Any(c => c is SshCheck)) || value == _enabled) + if ((LoginType == LoginType.PrivateKey && PrivateKeyFile == null && value == true && HasSshChecks) || value == _enabled) return; _enabled = value; EnabledChanged?.Invoke(this, new EventArgs()); @@ -176,6 +177,8 @@ } } + public bool HasSshChecks => Checks.Any(c => c is SshCheck); + /// Deletes a check from the server. /// The check to delete. public void DeleteCheck(Check check)