You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2021/12/15 14:17:52 UTC

[GitHub] [ratis] ferhui commented on a change in pull request #564: RATIS-1470. Add peerId option to group list

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



##########
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:
       @szetszwo Thanks for your review!
   Because have added these 2 options to option group as @maobaolong suggested, if there are no these  2 options, it would not run into this run method. Do we need to add else-clause to catch the illegal argument?




-- 
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: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org