You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "Abyss-lord (via GitHub)" <gi...@apache.org> on 2025/01/06 06:36:49 UTC

[PR] [#6102] fix(CLI): Fix Exception thrown when trying to set multiple tags properties in Gravitino CLI [gravitino]

Abyss-lord opened a new pull request, #6111:
URL: https://github.com/apache/gravitino/pull/6111

   ### What changes were proposed in this pull request?
   
   Fix Exception thrown when trying to set multiple tags properties in Gravitino CLI. It should give some user-friendly information.
   
   ### Why are the changes needed?
   
   Fix: #6102 
   
   ### Does this PR introduce _any_ user-facing change?
   
   No
   
   ### How was this patch tested?
   
   ut + local test
   ```bash
   gcli tag set --metalake demo_metalake --tag tagA tagB tagC --property test --value value
   # This command only supports one --tag option.
   
   gcli tag details --metalake demo_metalake --tag tagA tagB tagC 
   # This command only supports one --tag option.
   
   gcli tag remove --metalake demo_metalake   --tag tagA tagB tagC  --property test
   # This command only supports one --tag option.
   
   gcli tag update --metalake demo_metalake --tag tagA tagB tagC --comment "new comment"
   # This command only supports one --tag option.
   
   gcli tag update --metalake demo_metalake --tag tagA tagB tagC --rename "new name"
   # This command only supports one --tag option.
   ```
   


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#6102] fix(CLI): Fix Exception thrown when trying to set multiple tags properties in Gravitino CLI [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean merged PR #6111:
URL: https://github.com/apache/gravitino/pull/6111


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#6102] fix(CLI): Fix Exception thrown when trying to set multiple tags properties in Gravitino CLI [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on code in PR #6111:
URL: https://github.com/apache/gravitino/pull/6111#discussion_r1903807092


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -724,7 +724,10 @@ protected void handleTagCommand() {
   }
 
   private String getOneTag(String[] tags) {
-    Preconditions.checkArgument(tags.length <= 1, ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+    if (tags.length > 1) {
+      System.err.println(ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+      Main.exit(-1);
+    }

Review Comment:
   No, this method is an instance method of Command and cannot be used directly in Commandline.
   ![image](https://github.com/user-attachments/assets/2db2abfa-6c41-4839-83a4-245e91bdd02a)
   



##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -724,7 +724,10 @@ protected void handleTagCommand() {
   }
 
   private String getOneTag(String[] tags) {
-    Preconditions.checkArgument(tags.length <= 1, ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+    if (tags.length > 1) {
+      System.err.println(ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+      Main.exit(-1);
+    }

Review Comment:
   @justinmclean No, this method is an instance method of Command and cannot be used directly in Commandline.
   ![image](https://github.com/user-attachments/assets/2db2abfa-6c41-4839-83a4-245e91bdd02a)
   



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#6102] fix(CLI): Fix Exception thrown when trying to set multiple tags properties in Gravitino CLI [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6111:
URL: https://github.com/apache/gravitino/pull/6111#discussion_r1903785392


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -724,7 +724,10 @@ protected void handleTagCommand() {
   }
 
   private String getOneTag(String[] tags) {
-    Preconditions.checkArgument(tags.length <= 1, ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+    if (tags.length > 1) {
+      System.err.println(ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+      Main.exit(-1);
+    }

Review Comment:
   You can use exitWithError here?



-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#6102] fix(CLI): Fix Exception thrown when trying to set multiple tags properties in Gravitino CLI [gravitino]

Posted by "Abyss-lord (via GitHub)" <gi...@apache.org>.
Abyss-lord commented on PR #6111:
URL: https://github.com/apache/gravitino/pull/6111#issuecomment-2572398700

   Hi @justinmclean @tengqm , could you please review this PR when you have time? I’d really appreciate your feedback.
   


-- 
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: commits-unsubscribe@gravitino.apache.org

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


Re: [PR] [#6102] fix(CLI): Fix Exception thrown when trying to set multiple tags properties in Gravitino CLI [gravitino]

Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean commented on code in PR #6111:
URL: https://github.com/apache/gravitino/pull/6111#discussion_r1903829571


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -724,7 +724,10 @@ protected void handleTagCommand() {
   }
 
   private String getOneTag(String[] tags) {
-    Preconditions.checkArgument(tags.length <= 1, ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+    if (tags.length > 1) {
+      System.err.println(ErrorMessages.MULTIPLE_TAG_COMMAND_ERROR);
+      Main.exit(-1);
+    }

Review Comment:
   Right you are



-- 
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: commits-unsubscribe@gravitino.apache.org

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