Copilot commented on code in PR #5047:
URL: https://github.com/apache/solr/pull/5047#discussion_r4210345673


##########
solr/core/src/java/org/apache/solr/cli/ConnectionOptions.java:
##########
@@ -73,4 +76,78 @@ String effectiveSolrUrl() throws IOException {
     }
     return solrUrl;
   }
+
+  static String resolveSolrUrl(ConnectionOptions connectionOptions, 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 solrConnectionProp = EnvUtils.getProperty("solr.connection");
+    if (solrConnectionProp != null && !solrConnectionProp.isBlank()) {
+      var connection = 
CloudSolrClient.CloudSolrClientConnection.parse(solrConnectionProp);
+      if (connection.isZookeeper()) {
+        return CLIUtils.solrUrlFromConnection(connection, credentials);
+      }
+      return CLIUtils.normalizeSolrUrl(connection.quorumItems().get(0));
+    }
+
+    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 "
+            + defaultUrl
+            + ".");
+    return defaultUrl;
+  }
+
+  static String resolveZkHost(
+      ConnectionOptions connectionOptions, String solrUrl, String credentials) 
throws Exception {
+    if (connectionOptions != null) {
+      String zkHost = connectionOptions.effectiveZkHost();
+      if (zkHost != null) {
+        return zkHost;
+      }
+    }
+
+    String solrConnectionProp = EnvUtils.getProperty("solr.connection");
+    if (solrConnectionProp != null && !solrConnectionProp.isBlank()) {
+      var connection = 
CloudSolrClient.CloudSolrClientConnection.parse(solrConnectionProp);
+      if (connection.isZookeeper()) {
+        return solrConnectionProp;
+      }
+    }
+
+    String zkHostProp = EnvUtils.getProperty("zkHost");
+    if (zkHostProp != null && !zkHostProp.isBlank()) {
+      return zkHostProp;
+    }

Review Comment:
   When an explicit HTTP target selects cluster B but `SOLR_CONNECTION` or 
`ZK_HOST` points to cluster A, `resolveSolrUrl` keeps B while these fallbacks 
return A. `PackageManager` then combines B's Solr client with A's ZooKeeper 
client, so one package operation can affect two clusters. Skip environment 
fallbacks once `connectionOptions` selected an HTTP target and discover 
ZooKeeper from the resolved `solrUrl` instead; add a conflicting-target 
regression test.



##########
solr/solr-ref-guide/modules/deployment-guide/pages/cli/index.adoc:
##########
@@ -62,6 +62,16 @@ Any command not listed here is unavailable when the picocli 
implementation is en
 |xref:cli/solr-auth.adoc[bin/solr auth]
 |xref:cli/solr-create.adoc[bin/solr create]
 |xref:cli/solr-delete.adoc[bin/solr delete]
+|xref:cli/solr-package-add-key.adoc[bin/solr package add key]
+|xref:cli/solr-package-add-repo.adoc[bin/solr package add repo]
+|xref:cli/solr-package-deploy.adoc[bin/solr package deploy]
+|xref:cli/solr-package-install.adoc[bin/solr package install]
+|xref:cli/solr-package-list-available.adoc[bin/solr package list available]

Review Comment:
   These labels are not valid invocations: the registered leaf names are 
`add-key`, `add-repo`, `list-available`, etc., but the generated table turns 
every hyphen into a command separator. Copying `bin/solr package add key` 
therefore produces an unknown-subcommand error. The same expansion affects the 
generated page titles and navigation; preserve the actual picocli command names 
in the docs generator and regenerate these pages.



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

Reply via email to