Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
 public async Task <string> CheckDocker(SetSSHDetailsRequest request)
 {
     return(await _installerService.CheckDocker(request));
 }
Esempio n. 5
0
 public async Task <bool> TestSshDetails(SetSSHDetailsRequest request)
 {
     return(await _installerService.TestSshDetails(request));
 }
Esempio n. 6
0
 public async Task <string> CheckDocker(SetSSHDetailsRequest request)
 {
     return(await RunCommand(request, "docker ps"));
 }
Esempio n. 7
0
 public async Task <string> CheckSpace(SetSSHDetailsRequest request)
 {
     return(await RunCommand(request, "df -H"));
 }