ferhui commented on a change in pull request #564:
URL: https://github.com/apache/ratis/pull/564#discussion_r769683271



##########
File path: 
ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/group/GroupListCommand.java
##########
@@ -51,15 +53,25 @@ public String getCommandName() {
   @Override
   public int run(CommandLine cl) throws IOException {
     super.run(cl);
-    String strAddr = cl.getOptionValue(SERVER_ADDRESS_OPTION_NAME);
-    final InetSocketAddress serverAddress = parseInetSocketAddress(strAddr);
-    final RaftPeerId peerId = RaftUtils.getPeerId(serverAddress);
+    RaftPeerId peerId = null;
+    String strAddr = null;
+    if(cl.hasOption(SERVER_ADDRESS_OPTION_NAME)) {
+      strAddr = cl.getOptionValue(SERVER_ADDRESS_OPTION_NAME);
+      final InetSocketAddress serverAddress = parseInetSocketAddress(strAddr);
+      peerId = RaftUtils.getPeerId(serverAddress);
+    } else if (cl.hasOption(PEER_ID_OPTION_NAME)) {
+      peerId = 
RaftPeerId.getRaftPeerId(cl.getOptionValue(PEER_ID_OPTION_NAME));
+      strAddr = getRaftGroup().getPeer(peerId).getAddress();
+    }

Review comment:
       Got it, thank you!




-- 
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]


Reply via email to