Skip to content

SOLR-17697: Implement picocli for auth command / AuthTool - #4684

Merged
janhoy merged 2 commits into
apache:jira/SOLR-17697-picoclifrom
janhoy:jira/SOLR-17697-picocli-auth
Aug 3, 2026
Merged

SOLR-17697: Implement picocli for auth command / AuthTool#4684
janhoy merged 2 commits into
apache:jira/SOLR-17697-picoclifrom
janhoy:jira/SOLR-17697-picocli-auth

Conversation

@janhoy

@janhoy janhoy commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Adds picocli support to AuthTool following the established dual-path pattern:

  • Business logic extracted from the commons-cli-coupled handleBasicAuth(CommandLine) into enableBasicAuth/disableBasicAuth operating on a shared AuthParams record plus a pluggable zk-host resolver, so both parsing paths run identical code.
  • @Command annotation with examples and exit codes; enable|disable as a positional parameter; options mirror the commons-cli definitions, with connection/credentials options provided by the ZkConnectionOptions mixin (includes the new -s/--solr-connection).
  • AuthTool registered as a SolrCLI subcommand; generated solr-auth.adoc ref-guide page included.
  • AuthToolPicocliTest runs the whole existing AuthToolTest suite through picocli.CommandLine.execute().

Boolean-ish options (--block-unknown etc.) stay string-typed so both paths emit the same validation message asserted by test_auth.bats. Connection parsing remains string-only; no I/O happens during argument parsing.

Verified: AuthToolTest + AuthToolPicocliTest green, test_auth.bats green on the commons-cli path and the picocli path (SOLR_PICOCLI=true), check -x test with Error Prone.

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests cat:cli labels Jul 30, 2026
Comment thread solr/core/src/java/org/apache/solr/cli/AuthTool.java Outdated
janhoy added 2 commits July 31, 2026 03:10
…methods

Restructures the monolithic handleBasicAuth(cli) into an AuthParams record
and cli-free handleCommand()/enableBasicAuth()/disableBasicAuth()/
clearSecurityJson() methods. The ZooKeeper connection string is resolved
once in runImpl (skipped with --update-include-file-only) and passed as a
plain nullable String; error reporting stays at the existing check sites.
No functional change intended.
Adds the picocli annotation, option fields and callTool() to AuthTool,
building the same AuthParams and calling the same handleCommand() as the
commons-cli path. Includes AuthToolPicocliTest running the inherited
AuthToolTest suite through picocli, and ref-guide docs for bin/solr auth.
@janhoy
janhoy force-pushed the jira/SOLR-17697-picocli-auth branch from a0bab52 to 0e3d509 Compare July 31, 2026 01:14
@janhoy janhoy changed the title SOLR-17697: Implement picocli for auth command SOLR-17697: Implement picocli for auth command / AuthTool Jul 31, 2026
@janhoy
janhoy merged commit 91c9460 into apache:jira/SOLR-17697-picocli Aug 3, 2026
1 check passed
@janhoy
janhoy deleted the jira/SOLR-17697-picocli-auth branch August 3, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat:cli documentation Improvements or additions to documentation tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants