more fixes for the combined plugin

* move static initialization hack for UnboundID Debug to XPackPlugin
* cleanup bundlePlugin calls in build file
* properly disable watcher and marvel for shield core tests

Original commit: elastic/x-pack-elasticsearch@2b89cf2225
This commit is contained in:
jaymode 2015-12-03 14:56:12 -05:00
parent aca0c96d6a
commit a039acf578
4 changed files with 37 additions and 44 deletions

View File

@ -6,9 +6,7 @@ dependencies {
integTest {
includePackaged true
systemProperty 'es.watcher.enabled', 'false'
systemProperty 'es.marvel.enabled', 'false'
systemProperty 'tests.rest.blacklist',
systemProperty 'tests.rest.blacklist',
['indices.get/10_basic/*allow_no_indices*',
'cat.count/10_basic/Test cat count output',
'cat.aliases/10_basic/Empty cluster',
@ -33,6 +31,8 @@ integTest {
cluster {
plugin 'x-pack', project(':x-plugins:elasticsearch:x-pack')
systemProperty 'es.watcher.enabled', 'false'
systemProperty 'es.marvel.enabled', 'false'
setupCommand 'setupDummyUser',
'bin/x-pack/esusers', 'useradd', 'test_user', '-p', 'changeme', '-r', 'admin'
waitCondition = { node, ant ->

View File

@ -101,13 +101,6 @@ forbiddenPatterns {
exclude '**/*.p12'
}
bundlePlugin {
from(project(':x-plugins').projectDir) {
include 'LICENSE.txt'
include 'NOTICE.txt'
}
}
// TODO: standardize packaging config for plugins
bundlePlugin {
from(projectDir) {
@ -120,7 +113,7 @@ bundlePlugin {
from('shield/config/shield') {
into 'config'
}
from('shield/bin/watcher') {
from('watcher/bin/watcher') {
into 'bin'
}

View File

@ -5,7 +5,6 @@
*/
package org.elasticsearch.shield;
import org.elasticsearch.SpecialPermission;
import org.elasticsearch.action.ActionModule;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.support.Headers;
@ -17,8 +16,6 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.http.HttpServerModule;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.shard.IndexEventListener;
import org.elasticsearch.plugins.Plugin;
import org.elasticsearch.rest.RestModule;
import org.elasticsearch.shield.action.ShieldActionFilter;
@ -75,36 +72,6 @@ public class ShieldPlugin extends Plugin {
private final boolean clientMode;
private ShieldLicenseState shieldLicenseState;
// TODO: clean up this library to not ask for write access to all system properties!
static {
// invoke this clinit in unbound with permissions to access all system properties
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
}
try {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
try {
Class.forName("com.unboundid.util.Debug");
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return null;
}
});
// TODO: fix gradle to add all shield resources (plugin metadata) to test classpath
// of watcher plugin, which depends on it directly. This prevents these plugins
// from being initialized correctly by the test framework, and means we have to
// have this leniency.
} catch (ExceptionInInitializerError bogus) {
if (bogus.getCause() instanceof SecurityException == false) {
throw bogus; // some other bug
}
}
}
public ShieldPlugin(Settings settings) {
this.settings = settings;
this.enabled = shieldEnabled(settings);

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack;
import org.elasticsearch.SpecialPermission;
import org.elasticsearch.action.ActionModule;
import org.elasticsearch.cluster.ClusterModule;
import org.elasticsearch.common.component.LifecycleComponent;
@ -24,6 +25,8 @@ import org.elasticsearch.shield.authz.AuthorizationModule;
import org.elasticsearch.transport.TransportModule;
import org.elasticsearch.watcher.WatcherPlugin;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
@ -33,6 +36,36 @@ public class XPackPlugin extends Plugin {
private final static ESLogger logger = Loggers.getLogger(XPackPlugin.class);
// TODO: clean up this library to not ask for write access to all system properties!
static {
// invoke this clinit in unbound with permissions to access all system properties
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(new SpecialPermission());
}
try {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@Override
public Void run() {
try {
Class.forName("com.unboundid.util.Debug");
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
return null;
}
});
// TODO: fix gradle to add all shield resources (plugin metadata) to test classpath
// of watcher plugin, which depends on it directly. This prevents these plugins
// from being initialized correctly by the test framework, and means we have to
// have this leniency.
} catch (ExceptionInInitializerError bogus) {
if (bogus.getCause() instanceof SecurityException == false) {
throw bogus; // some other bug
}
}
}
protected final Settings settings;
protected LicensePlugin licensePlugin;
protected ShieldPlugin shieldPlugin;