jaykay12 commented on code in PR #4739:
URL: https://github.com/apache/solr/pull/4739#discussion_r4172986496
##########
solr/core/src/java/org/apache/solr/cli/PackageTool.java:
##########
@@ -381,6 +492,64 @@ public Options getOptions() {
@Override
public int callTool() throws Exception {
- throw new UnsupportedOperationException("This tool does not yet support
PicoCli");
+ String credentials = credentialsOptions.credentials;
+ String solrUrl = resolveSolrUrl(credentials);
+ String zkHost = resolveZkHost(solrUrl, credentials);
+ String[] args = cmdArgs == null ? new String[0] : cmdArgs;
+ PackageFlags packageFlags =
+ new PackageFlags(collections, cluster, param, update, collection,
noPrompt);
+ executePackage(solrUrl, zkHost, credentials, cmd, args, packageFlags);
+ return 0;
+ }
+
+ private String resolveSolrUrl(String credentials) throws Exception {
+ if (connectionOptions != null) {
+ String solrUrl = connectionOptions.effectiveSolrUrl();
+ if (solrUrl != null) {
+ return CLIUtils.normalizeSolrUrl(solrUrl);
+ }
+ String zkHost = connectionOptions.effectiveZkHost();
+ if (zkHost != null) {
+ return CLIUtils.solrUrlFromConnection(
+ CloudSolrClient.CloudSolrClientConnection.parse(zkHost),
credentials);
+ }
+ }
+ String zkHostProp = EnvUtils.getProperty("zkHost");
+ if (zkHostProp != null && !zkHostProp.isBlank()) {
+ return CLIUtils.solrUrlFromConnection(
+ CloudSolrClient.CloudSolrClientConnection.parse(zkHostProp),
credentials);
+ }
+ String defaultUrl = CLIUtils.getDefaultSolrUrl();
+ CLIO.err(
+ "Neither --solr-connection, --zk-host or --solr-url parameters, nor
SOLR_CONNECTION, ZK_HOST env var provided, so assuming solr url is "
Review Comment:
Took help of cursor to understand this, still not fully sure of the
implications here.
AI reply:
```
Fixed on the picocli path: when the ArgGroup is unmatched we read
solr-connection / zkHost from env before the default URL, so the message
matches behaviour. The ArgGroup default-provider issue remains #3254.
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]