noblepaul commented on a change in pull request #1631:
URL: https://github.com/apache/lucene-solr/pull/1631#discussion_r447534197



##########
File path: solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
##########
@@ -244,24 +306,114 @@ private boolean deployPackage(SolrPackageInstance 
packageInstance, boolean pegTo
       }
     }
 
+    if (previouslyDeployed.isEmpty() == false) {
+      PackageUtils.printRed("Already Deployed on " + previouslyDeployed + ", 
package: " + packageInstance.name + ", version: " + packageInstance.version);
+    }
+
     List<String> deployedCollections = collections.stream().filter(c -> 
!previouslyDeployed.contains(c)).collect(Collectors.toList());
+    return new Pair<List<String>, List<String>>(deployedCollections, 
previouslyDeployed);
+  }
 
-    boolean success = true;
-    if (deployedCollections.isEmpty() == false) {
-      // Verify that package was successfully deployed
-      success = verify(packageInstance, deployedCollections);
-      if (success) {
-        PackageUtils.printGreen("Deployed on " + deployedCollections + " and 
verified package: " + packageInstance.name + ", version: " + 
packageInstance.version);
+  @SuppressWarnings("unchecked")
+  private boolean deployClusterPackage(SolrPackageInstance packageInstance, 
boolean isUpdate, boolean noprompt,
+      boolean shouldDeployClusterPlugins, String[] overrides) {
+    boolean cluasterPluginFailed = false;
+
+    if (isUpdate) {
+      for (Plugin plugin: packageInstance.plugins) {
+        if (!shouldDeployClusterPlugins || 
"cluster".equalsIgnoreCase(plugin.type) == false) continue;
+        SolrPackageInstance deployedPackage = 
getPackagesDeployedAsClusterLevelPlugins().get(packageInstance.name);
+        if (deployedPackage == null) {
+          PackageUtils.printRed("Cluster level plugin " + plugin.name + " from 
package " + packageInstance.name + " not deployed. To deploy, remove the 
--update parameter.");
+          cluasterPluginFailed = true;
+          continue;
+        }
+        for (Map<String, String> pluginMeta: (List<Map<String, 
String>>)deployedPackage.getCustomData()) {
+          PackageUtils.printGreen("Updating this plugin: " + pluginMeta);
+          try {
+            String postBody = "{\"update\":{\"name\": 
\""+pluginMeta.get("name")+"\","
+                + " \"class\": \""+pluginMeta.get("class")+"\", \"version\": 
\""+packageInstance.version+"\", \"path-prefix\": 
\""+pluginMeta.get("path-prefix")+"\"}}";

Review comment:
       what if there is no `path-prefix` ?
   
   Use the POJO `PluginMeta` and it will take care of these things. You do not 
need to construct this json string
   




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to