private static async Task <List <ActionResult> > RunSSHScript(ILog log, string command, string args, DeploymentTaskConfig settings, Dictionary <string, string> credentials) { var sshConfig = SshClient.GetConnectionConfig(settings, credentials); var ssh = new SshClient(sshConfig); var commandList = new List <string> { $"{command} {args}" }; log?.Information($"Executing command via SSH [{sshConfig.Host}:{sshConfig.Port}]"); var scriptResults = await Task.FromResult(ssh.ExecuteCommands(commandList, log)); if (scriptResults.Any(r => r.IsError)) { var firstError = scriptResults.First(c => c.IsError); return(new List <ActionResult> { new ActionResult { IsSuccess = false, Message = $"One or more commands failed: {firstError.Command} :: {firstError.Result}" } }); } else { return(new List <ActionResult> { new ActionResult { IsSuccess = true, Message = "Command Completed" } }); } }