public async Task <string> RunCommand(SetSSHDetailsRequest request, string command) { var client = await Connect(request); var cmd = client?.RunCommand(command); return(string.IsNullOrEmpty(cmd?.Result)? cmd?.Error : cmd?.Result); }
public async Task <SshClient> Connect(SetSSHDetailsRequest request) { try { var client = new SshClient(request.Host, request.Username, request.Password); client.Connect(); client.KeepAliveInterval = TimeSpan.FromSeconds(5); var id = Guid.NewGuid().ToString(); return(client); } catch (Exception) { return(null); } }
public async Task <bool> TestSshDetails(SetSSHDetailsRequest request) { try { var client = await Connect(request); if (client == null) { return(false); } await Disconnect(client); return(true); } catch (Exception) { return(false); } }
public async Task <string> CheckDocker(SetSSHDetailsRequest request) { return(await _installerService.CheckDocker(request)); }
public async Task <bool> TestSshDetails(SetSSHDetailsRequest request) { return(await _installerService.TestSshDetails(request)); }
public async Task <string> CheckDocker(SetSSHDetailsRequest request) { return(await RunCommand(request, "docker ps")); }
public async Task <string> CheckSpace(SetSSHDetailsRequest request) { return(await RunCommand(request, "df -H")); }