BukrosSzabolcs commented on a change in pull request #675: HBASE-23085: Network and Data related Actions URL: https://github.com/apache/hbase/pull/675#discussion_r332063015
########## File path: hbase-it/src/test/java/org/apache/hadoop/hbase/HBaseClusterManager.java ########## @@ -336,6 +378,50 @@ protected CommandProvider getCommandProvider(ServiceType service) throws IOExcep } } + /** + * Execute the given command on the host using SSH + * @return pair of exit code and command output + * @throws IOException if something goes wrong. + */ + public Pair<Integer, String> execSudo(String hostname, long timeout, String... cmd) + throws IOException { + LOG.info("Executing remote command: " + StringUtils.join(cmd, " ") + " , hostname:" + hostname); + + RemoteSudoShell shell = new RemoteSudoShell(hostname, cmd, timeout); + try { + shell.execute(); + } catch (Shell.ExitCodeException ex) { + // capture the stdout of the process as well. + String output = shell.getOutput(); + // add output for the ExitCodeException. + throw new Shell.ExitCodeException(ex.getExitCode(), "stderr: " + ex.getMessage() + + ", stdout: " + output); + } + + LOG.info("Executed remote command, exit code:" + shell.getExitCode() + + " , output:" + shell.getOutput()); Review comment: Thanks for noticing ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services