Mercurial > servermonitor
diff ServerMonitor/Objects/Checks/SshCheck.cs @ 5:b6fe203af9d5
Private key passwords and validation
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Thu, 28 Feb 2019 21:19:32 -0500 |
parents | 3142e52cbe69 |
children | 052aa62cb42a |
line wrap: on
line diff
--- a/ServerMonitor/Objects/Checks/SshCheck.cs Sun Feb 10 20:51:26 2019 -0500 +++ b/ServerMonitor/Objects/Checks/SshCheck.cs Thu Feb 28 21:19:32 2019 -0500 @@ -29,12 +29,19 @@ protected override Task<CheckResult> ExecuteCheckAsync(CancellationToken token) { + try + { + if (!Server.SshClient.IsConnected) + Server.SshClient.Connect(); + } + catch (Exception e) + { + return Task.FromResult(Fail(e)); + } return Task.Run(() => { try { - if (!Server.SshClient.IsConnected) - Server.SshClient.Connect(); token.ThrowIfCancellationRequested(); using (SshCommand command = Server.SshClient.CreateCommand(Command)) {