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/07 03:16:43 UTC

[PR] [#6123] fix(CLI): Refactor the validation logic of tag and role [gravitino]

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

   ### What changes were proposed in this pull request?
   
   Refactor the validation logic of the Tag and Role, meantime  fix the test case.
   
   ### Why are the changes needed?
   
   Fix: #6123 
   
   ### Does this PR introduce _any_ user-facing change?
   
   No
   
   ### How was this patch tested?
   
   ut + local test
   
   **Role test**
   ```bash
   gcli role grant -m demo_metalake --role admin
   # Missing --privilege option.
   
   gcli role revoke -m demo_metalake --role admin
   # Missing --privilege option.
   ```
   
   **Tag test**
   
   ```bash
   gcli tag set -m demo_metalake 
   # Missing --name option.
   
   gcli tag set -m demo_metalake  --name catalog.schema.table --property property --tag tagA
   # Missing --value option.
   
   gcli tag set -m demo_metalake  --name catalog.schema.table --value value --tag tagA
   # Missing --property option.
   
   gcli tag remove -m demo_metalake --tag tagA
   # Missing --name option.
   
   gcli tag remove -m demo_metalake
   # Missing --name option.
   
   gcli tag delete -m demo_metalake
   # Missing --tag option.
   
   gcli tag create -m demo_metalake
   # Missing --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] [#6123] fix(CLI): Refactor the validation logic of tag and role [gravitino]

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


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -805,9 +793,12 @@ url, ignore, metalake, getOneRole(roles, CommandActions.REMOVE), name, privilege
     }
   }
 
-  private String getOneRole(String[] roles, String command) {
-    Preconditions.checkArgument(
-        roles.length == 1, command + " requires only one role, but multiple are currently passed.");
+  private String getOneRole(String[] roles) {

Review Comment:
   Not 100% sure whether this is actually needed.
   Sounds like this is not a new topic.



-- 
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] [#6123] fix(CLI): Refactor the validation logic of tag and role [gravitino]

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

   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] [#6123] fix(CLI): Refactor the validation logic of tag and role [gravitino]

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


-- 
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] [#6123] fix(CLI): Refactor the validation logic of tag and role [gravitino]

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


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -805,9 +793,12 @@ url, ignore, metalake, getOneRole(roles, CommandActions.REMOVE), name, privilege
     }
   }
 
-  private String getOneRole(String[] roles, String command) {
-    Preconditions.checkArgument(
-        roles.length == 1, command + " requires only one role, but multiple are currently passed.");
+  private String getOneRole(String[] roles) {

Review Comment:
   Some commands support multiple roles some do not, so it is needed.



-- 
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] [#6123] fix(CLI): Refactor the validation logic of tag and role [gravitino]

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


##########
clients/cli/src/main/java/org/apache/gravitino/cli/GravitinoCommandLine.java:
##########
@@ -736,7 +724,7 @@ protected void handleTagCommand() {
   }
 
   private String getOneTag(String[] tags) {
-    if (tags.length > 1) {
+    if (tags == null || tags.length > 1) {

Review Comment:
   I don't think it is possible for tags to be null at this point, but I guess it doesn't hurt



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