Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HDDS-11991. Use picocli built-in for missing subcommand of GenericCli #7635

Merged
merged 3 commits into from
Jan 7, 2025

Conversation

adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

  • GenericCli does not need to implement Callable only for showing "incomplete command". The same functionality is provided by picocli.
    • Implement Callable in subclasses where missing. Implement Runnable where call() does not throw checked exceptions.
    • Remove MissingSubcommandException, no longer used.
  • Remove explicit check for required parameter in GetUserInfoHandler, picocli does it for us.
    • Remove missingSubcommand method from GenericCli, no longer used.

https://issues.apache.org/jira/browse/HDDS-11991

How was this patch tested?

Tested GetUserInfoHandler without arguments:

$ ozone tenant user info
Missing required parameter: '<userPrincipal>'
Usage: ozone tenant user info [-hjV] [--om-service-id=<omServiceID>]
                              <userPrincipal>
Get tenant related information of a user
      <userPrincipal>   User name (principal)
  -h, --help            Show this help message and exit.
  -j, --json            Print result in JSON
      --om-service-id=<omServiceID>
                        Service ID is required when OM is running in HA cluster
  -V, --version         Print version information and exit.

Acceptance test covers GenericCli without subcommand (for top-level command ozone admin).

CI:
https://github.com/adoroszlai/ozone/actions/runs/12595048598

@adoroszlai adoroszlai added the tools Tools that helps with debugging label Jan 3, 2025
@adoroszlai adoroszlai self-assigned this Jan 3, 2025
@nandakumar131
Copy link
Contributor

@adoroszlai thanks for the improvement. Overall the change looks good to me, one minor comment.
Can we just use Callable in all places so that it will be consistent and uniform?

@adoroszlai
Copy link
Contributor Author

Thanks @nandakumar131 for the review.

Can we just use Callable in all places so that it will be consistent and uniform?

Updated.

@nandakumar131 nandakumar131 merged commit ae9a56f into apache:master Jan 7, 2025
42 checks passed
@nandakumar131
Copy link
Contributor

Thanks @adoroszlai for the contribution!

@adoroszlai adoroszlai deleted the HDDS-11991 branch January 7, 2025 07:07
@adoroszlai
Copy link
Contributor Author

Thanks @nandakumar131 for reviewing and merging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Tools that helps with debugging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants