fixed a license disabled behaviour
When the license is disabled (expired) we need to also block the nodes stats API Fixes elastic/elasticsearch#671 Original commit: elastic/x-pack-elasticsearch@277c470889
This commit is contained in:
parent
82fc8fb9bf
commit
dd5332500c
|
@ -40,7 +40,11 @@ public abstract class Privilege<P extends Privilege<P>> {
|
|||
static final String SUB_ACTION_SUFFIX_PATTERN = "*";
|
||||
|
||||
public static final System SYSTEM = new System();
|
||||
public static final General HEALTH_AND_STATS = new General("health_and_stats", "cluster:monitor/health*", "cluster:monitor/stats*", "indices:monitor/stats*");
|
||||
public static final General HEALTH_AND_STATS = new General("health_and_stats",
|
||||
"cluster:monitor/health*",
|
||||
"cluster:monitor/stats*",
|
||||
"indices:monitor/stats*",
|
||||
"cluster:monitor/nodes/stats*");
|
||||
|
||||
protected final Name name;
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
package org.elasticsearch.integration;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsResponse;
|
||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsIndices;
|
||||
import org.elasticsearch.action.admin.cluster.stats.ClusterStatsResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
|
@ -154,6 +155,14 @@ public class LicensingTests extends ShieldIntegrationTest {
|
|||
assertThat(lee.feature(), equalTo(LicenseService.FEATURE_NAME));
|
||||
}
|
||||
|
||||
try {
|
||||
client.admin().cluster().prepareNodesStats().get();
|
||||
fail("expected an license expired exception when executing cluster health action");
|
||||
} catch (LicenseExpiredException lee) {
|
||||
// expected
|
||||
assertThat(lee.feature(), equalTo(LicenseService.FEATURE_NAME));
|
||||
}
|
||||
|
||||
enableLicensing();
|
||||
|
||||
IndicesStatsResponse indicesStatsResponse = client.admin().indices().prepareStats().get();
|
||||
|
@ -167,6 +176,9 @@ public class LicensingTests extends ShieldIntegrationTest {
|
|||
|
||||
ClusterHealthResponse clusterIndexHealth = client.admin().cluster().prepareHealth().get();
|
||||
assertThat(clusterIndexHealth, notNullValue());
|
||||
|
||||
NodesStatsResponse nodeStats = client.admin().cluster().prepareNodesStats().get();
|
||||
assertThat(nodeStats, notNullValue());
|
||||
}
|
||||
|
||||
public static void disableLicensing() {
|
||||
|
|
Loading…
Reference in New Issue