devmadhuu commented on code in PR #6376:
URL: https://github.com/apache/ozone/pull/6376#discussion_r1550831722
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java:
##########
@@ -385,4 +396,61 @@ public SCMNodeDetails
getReconNodeDetails(OzoneConfiguration conf) {
HddsServerUtil.getReconDataNodeBindAddress(conf));
return builder.build();
}
+
+ /**
+ * This method accepts the list of command args and supports execution of
ozone CLI based commands only.
+ *
+ * @param commandArgs the list of command args
+ * @return the command output map with its exit code
+ */
+ public Map<Integer, String> executeCommand(List<String> commandArgs) {
+ String command = joinListArgs(commandArgs);
+ Map<Integer, String> processOutputMap = new HashMap<>();
+ LOG.info("Received command : '{}' to execute", command);
+ AtomicReference<String> processOutput = new AtomicReference<>();
+ ProcessBuilder pb = new ProcessBuilder(commandArgs);
+ try {
+ SecurityUtil.doAsLoginUser((PrivilegedExceptionAction<Map<Integer,
String>>) () -> {
+ Process process = pb.start();
+ int exitCode = process.waitFor();
Review Comment:
Ok, sure.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]