Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions changelog/unreleased/SOLR-18520-uninstall-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title:
Package Uninstall should work in absence of clusterprops.json file
type: fixed
authors:
- name: Jalaz Kumar
nick: jaykay12
links:
- name: SOLR-18520
url: https://issues.apache.org/jira/browse/SOLR-18520
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import org.apache.solr.cli.SolrCLI;
import org.apache.solr.cli.ToolRuntime;
import org.apache.solr.client.api.util.SolrVersion;
import org.apache.solr.client.solrj.RemoteSolrException;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
Expand Down Expand Up @@ -154,7 +155,7 @@ public void uninstall(String packageName, String version)
del.pkg = packageName;

V2Request req =
new V2Request.Builder(PackageUtils.PACKAGE_PATH)
new V2Request.Builder("/cluster/package")
.forceV2(true)
.withMethod(SolrRequest.METHOD.POST)
.withPayload(Map.of("delete", del))
Expand Down Expand Up @@ -278,18 +279,18 @@ public Map<String, SolrPackageInstance> getPackagesDeployedAsClusterLevelPlugins
Map<String, String> packageVersions = new HashMap<>();
// map of package name to multiple values of pluginMeta(Map<String, String>)
Map<String, Set<PluginMeta>> packagePlugins = new HashMap<>();
Object pluginsValue;
Object pluginsValue = null;
try {
NamedList<Object> response =
solrClient.request(
new GenericV2SolrRequest(SolrRequest.METHOD.GET, PackageUtils.CLUSTERPROPS_PATH));
Integer statusCode = (Integer) response._get(List.of("responseHeader", "status"), null);
if (statusCode == null || statusCode == ErrorCode.NOT_FOUND.code) {
// Cluster props doesn't exist, that means there are no cluster level plugins installed.
pluginsValue = null;
} else {
if (statusCode != null && statusCode != ErrorCode.NOT_FOUND.code) {
// Cluster props exists, that means there are cluster level plugins installed.
pluginsValue = response.get(ContainerPluginsApi.PLUGIN);
}
} catch (RemoteSolrException ex) {
log.debug("Unable to fetch clusterprops for package plugins", ex);
} catch (SolrServerException | IOException ex) {
throw new SolrException(ErrorCode.SERVER_ERROR, ex);
}
Expand Down
Loading