comparison ServerMonitor/Objects/Checks/SshCheck.cs @ 13:a36cc5c123f4

Fix SSH command sublclasses holding on to old command strings after a program update.
author Brad Greco <brad@bgreco.net>
date Mon, 15 Apr 2019 19:25:27 -0400
parents 052aa62cb42a
children 68d7834dc28e
comparison
equal deleted inserted replaced
12:d92176c5398a 13:a36cc5c123f4
64 } 64 }
65 65
66 protected virtual List<CheckResult> ProcessCommandResult(string output, int exitCode) 66 protected virtual List<CheckResult> ProcessCommandResult(string output, int exitCode)
67 { 67 {
68 List<CheckResult> results = new List<CheckResult>(); 68 List<CheckResult> results = new List<CheckResult>();
69 if (CheckCommandOutput)
70 results.Add(GetStringResult(CommandOutputMatchType, CommandOutputPattern, CommandOutputUseRegex, output, "Command output"));
69 if (CheckExitCode) 71 if (CheckExitCode)
70 { 72 {
71 CheckResult result = GetIntResult(ExitCode, exitCode, "Exit code"); 73 CheckResult result = GetIntResult(ExitCode, exitCode, "Exit code");
72 if (result.Failed) 74 if (result.Failed)
73 result.Message += ". Command output: " + output; 75 result.Message += ". Command output: " + output;
74 results.Add(result); 76 results.Add(result);
75 } 77 }
76 if (CheckCommandOutput)
77 results.Add(GetStringResult(CommandOutputMatchType, CommandOutputPattern, CommandOutputUseRegex, output, "Command output"));
78 return results; 78 return results;
79 } 79 }
80 80
81 public override string Validate(bool saving = true) 81 public override string Validate(bool saving = true)
82 { 82 {