Watcher: Cut settings over to xpack.watcher (elastic/elasticsearch#1909)
This cuts over all settings from `watcher.` to `xpack.watcher` as part of the settings cleanup for 5.0. Relates elastic/elasticsearch#1441 Original commit: elastic/x-pack-elasticsearch@c82483bf25
This commit is contained in:
parent
cc55c8ed48
commit
a1f7fff901
|
@ -72,17 +72,18 @@ public class HipChatServiceIT extends AbstractWatcherIntegrationTestCase {
|
|||
.put(super.nodeSettings(nodeOrdinal))
|
||||
|
||||
// this is for the `test-watcher-integration` group level integration in HipChat
|
||||
.put("watcher.actions.hipchat.service.account.integration_account.profile", "integration")
|
||||
.put("watcher.actions.hipchat.service.account.integration_account.auth_token", "huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU")
|
||||
.put("watcher.actions.hipchat.service.account.integration_account.room", "test-watcher")
|
||||
.put("xpack.watcher.actions.hipchat.service.account.integration_account.profile", "integration")
|
||||
.put("xpack.watcher.actions.hipchat.service.account.integration_account.auth_token",
|
||||
"huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU")
|
||||
.put("xpack.watcher.actions.hipchat.service.account.integration_account.room", "test-watcher")
|
||||
|
||||
// this is for the Watcher Test account in HipChat
|
||||
.put("watcher.actions.hipchat.service.account.user_account.profile", "user")
|
||||
.put("watcher.actions.hipchat.service.account.user_account.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0")
|
||||
.put("xpack.watcher.actions.hipchat.service.account.user_account.profile", "user")
|
||||
.put("xpack.watcher.actions.hipchat.service.account.user_account.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0")
|
||||
|
||||
// this is for the `test-watcher-v1` notification token
|
||||
.put("watcher.actions.hipchat.service.account.v1_account.profile", "v1")
|
||||
.put("watcher.actions.hipchat.service.account.v1_account.auth_token", "a734baf62df618b96dda55b323fc30")
|
||||
.put("xpack.watcher.actions.hipchat.service.account.v1_account.profile", "v1")
|
||||
.put("xpack.watcher.actions.hipchat.service.account.v1_account.auth_token", "a734baf62df618b96dda55b323fc30")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public class PagerDutyServiceIT extends AbstractWatcherIntegrationTestCase {
|
|||
protected Settings nodeSettings(int nodeOrdinal) {
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("watcher.actions.pagerduty.service.account.test_account.service_api_key", "fc082467005d4072a914e0bb041882d0")
|
||||
.put("xpack.watcher.actions.pagerduty.service.account.test_account.service_api_key", "fc082467005d4072a914e0bb041882d0")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class SlackServiceIT extends AbstractWatcherIntegrationTestCase {
|
|||
.put(super.nodeSettings(nodeOrdinal))
|
||||
|
||||
// this is for the `test-watcher-integration` group level integration in HipChat
|
||||
.put("watcher.actions.slack.service.account.test_account.url",
|
||||
.put("xpack.watcher.actions.slack.service.account.test_account.url",
|
||||
"https://hooks.slack.com/services/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")
|
||||
.build();
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes,-serial,-
|
|||
ext.expansions = [
|
||||
'project.version': version,
|
||||
// Used in watcher index templates
|
||||
'watcher.template.version': '1',
|
||||
'xpack.watcher.template.version': '1',
|
||||
]
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -98,9 +98,9 @@ public class Watcher {
|
|||
public static final String NAME = "watcher";
|
||||
|
||||
public static final Setting<String> INDEX_WATCHER_VERSION_SETTING =
|
||||
new Setting<>("index.watcher.plugin.version", "", Function.identity(), Setting.Property.IndexScope);
|
||||
new Setting<>("index.xpack.watcher.plugin.version", "", Function.identity(), Setting.Property.IndexScope);
|
||||
public static final Setting<String> INDEX_WATCHER_TEMPLATE_VERSION_SETTING =
|
||||
new Setting<>("index.watcher.template.version", "", Function.identity(), Setting.Property.IndexScope);
|
||||
new Setting<>("index.xpack.watcher.template.version", "", Function.identity(), Setting.Property.IndexScope);
|
||||
|
||||
private static final ESLogger logger = Loggers.getLogger(XPackPlugin.class);
|
||||
|
||||
|
@ -181,36 +181,36 @@ public class Watcher {
|
|||
module.registerSetting(InternalPagerDutyService.PAGERDUTY_ACCOUNT_SETTING);
|
||||
module.registerSetting(INDEX_WATCHER_VERSION_SETTING);
|
||||
module.registerSetting(INDEX_WATCHER_TEMPLATE_VERSION_SETTING);
|
||||
module.registerSetting(Setting.intSetting("watcher.execution.scroll.size", 0, Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.intSetting("watcher.watch.scroll.size", 0, Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.intSetting("xpack.watcher.execution.scroll.size", 0, Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.intSetting("xpack.watcher.watch.scroll.size", 0, Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.boolSetting(XPackPlugin.featureEnabledSetting(Watcher.NAME), true, Setting.Property.NodeScope));
|
||||
module.registerSetting(SecretService.Secure.ENCRYPT_SENSITIVE_DATA_SETTING);
|
||||
|
||||
// TODO add real settings for these
|
||||
module.registerSetting(Setting.simpleString("watcher.internal.ops.search.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.internal.ops.bulk.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.internal.ops.index.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.execution.default_throttle_period", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.http.default_read_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.groupSetting("watcher.http.ssl.", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.groupSetting("watcher.http.proxy.", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.actions.index.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.index.rest.direct_access", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.trigger.schedule.engine", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.input.search.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.transform.search.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.trigger.schedule.ticker.tick_interval", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.execution.scroll.timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.start_immediately", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("watcher.http.default_connection_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.search.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.bulk.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.internal.ops.index.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.execution.default_throttle_period", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.http.default_read_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.groupSetting("xpack.watcher.http.ssl.", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.groupSetting("xpack.watcher.http.proxy.", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.actions.index.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.index.rest.direct_access", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.trigger.schedule.engine", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.input.search.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.transform.search.default_timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.trigger.schedule.ticker.tick_interval", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.execution.scroll.timeout", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.start_immediately", Setting.Property.NodeScope));
|
||||
module.registerSetting(Setting.simpleString("xpack.watcher.http.default_connection_timeout", Setting.Property.NodeScope));
|
||||
|
||||
module.registerSettingsFilter("watcher.actions.email.service.account.*.smtp.password");
|
||||
module.registerSettingsFilter("watcher.actions.slack.service.account.*.url");
|
||||
module.registerSettingsFilter("watcher.actions.pagerduty.service.account.*.url");
|
||||
module.registerSettingsFilter("watcher.actions.pagerduty.service." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
||||
module.registerSettingsFilter("watcher.actions.pagerduty.service.account.*." +
|
||||
module.registerSettingsFilter("xpack.watcher.actions.email.service.account.*.smtp.password");
|
||||
module.registerSettingsFilter("xpack.watcher.actions.slack.service.account.*.url");
|
||||
module.registerSettingsFilter("xpack.watcher.actions.pagerduty.service.account.*.url");
|
||||
module.registerSettingsFilter("xpack.watcher.actions.pagerduty.service." + PagerDutyAccount.SERVICE_KEY_SETTING);
|
||||
module.registerSettingsFilter("xpack.watcher.actions.pagerduty.service.account.*." +
|
||||
PagerDutyAccount.SERVICE_KEY_SETTING);
|
||||
module.registerSettingsFilter("watcher.actions.hipchat.service.account.*.auth_token");
|
||||
module.registerSettingsFilter("xpack.watcher.actions.hipchat.service.account.*.auth_token");
|
||||
}
|
||||
|
||||
public void onModule(NetworkModule module) {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class WatcherLifeCycleService extends AbstractComponent implements Cluste
|
|||
stop(false);
|
||||
}
|
||||
});
|
||||
watcherMetaData = new WatcherMetaData(!settings.getAsBoolean("watcher.start_immediately", true));
|
||||
watcherMetaData = new WatcherMetaData(!settings.getAsBoolean("xpack.watcher.start_immediately", true));
|
||||
}
|
||||
|
||||
public void start() {
|
||||
|
|
|
@ -23,16 +23,16 @@ import java.util.Properties;
|
|||
public class WatcherModule extends AbstractModule {
|
||||
|
||||
static final String PROPERTIES_FILE = "/watcher.properties";
|
||||
static final String VERSION_FIELD = "watcher.template.version";
|
||||
static final String VERSION_FIELD = "xpack.watcher.template.version";
|
||||
|
||||
public static final String HISTORY_TEMPLATE_NAME = "watch_history_" + getHistoryIndexTemplateVersion();
|
||||
public static final String TRIGGERED_TEMPLATE_NAME = "triggered_watches";
|
||||
public static final String WATCHES_TEMPLATE_NAME = "watches";
|
||||
public static final Setting<Settings> HISTORY_TEMPLATE_SETTING = Setting.groupSetting("watcher.history.index.",
|
||||
public static final Setting<Settings> HISTORY_TEMPLATE_SETTING = Setting.groupSetting("xpack.watcher.history.index.",
|
||||
Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
public static final Setting<Settings> TRIGGERED_TEMPLATE_SETTING = Setting.groupSetting("watcher.triggered_watches.index.",
|
||||
public static final Setting<Settings> TRIGGERED_TEMPLATE_SETTING = Setting.groupSetting("xpack.watcher.triggered_watches.index.",
|
||||
Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
public static final Setting<Settings> WATCHES_TEMPLATE_SETTING = Setting.groupSetting("watcher.watches.index.",
|
||||
public static final Setting<Settings> WATCHES_TEMPLATE_SETTING = Setting.groupSetting("xpack.watcher.watches.index.",
|
||||
Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ public class HtmlSanitizer {
|
|||
|
||||
@Inject
|
||||
public HtmlSanitizer(Settings settings) {
|
||||
enabled = settings.getAsBoolean("watcher.actions.email.html.sanitization.enabled", true);
|
||||
String[] allow = settings.getAsArray("watcher.actions.email.html.sanitization.allow", DEFAULT_ALLOWED);
|
||||
String[] disallow = settings.getAsArray("watcher.actions.email.html.sanitization.disallow", Strings.EMPTY_ARRAY);
|
||||
enabled = settings.getAsBoolean("xpack.watcher.actions.email.html.sanitization.enabled", true);
|
||||
String[] allow = settings.getAsArray("xpack.watcher.actions.email.html.sanitization.allow", DEFAULT_ALLOWED);
|
||||
String[] disallow = settings.getAsArray("xpack.watcher.actions.email.html.sanitization.disallow", Strings.EMPTY_ARRAY);
|
||||
policy = createCommonPolicy(allow, disallow);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public class InternalEmailService extends AbstractLifecycleComponent<EmailServic
|
|||
|
||||
private final SecretService secretService;
|
||||
public static final Setting<Settings> EMAIL_ACCOUNT_SETTING =
|
||||
Setting.groupSetting("watcher.actions.email.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
Setting.groupSetting("xpack.watcher.actions.email.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
|
||||
private volatile Accounts accounts;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class InternalHipChatService extends AbstractLifecycleComponent<HipChatSe
|
|||
private final HttpClient httpClient;
|
||||
private volatile HipChatAccounts accounts;
|
||||
public static final Setting<Settings> HIPCHAT_ACCOUNT_SETTING =
|
||||
Setting.groupSetting("watcher.actions.hipchat.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
Setting.groupSetting("xpack.watcher.actions.hipchat.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
|
||||
@Inject
|
||||
public InternalHipChatService(Settings settings, HttpClient httpClient, ClusterSettings clusterSettings) {
|
||||
|
|
|
@ -28,7 +28,7 @@ public class IndexActionFactory extends ActionFactory<IndexAction, ExecutableInd
|
|||
public IndexActionFactory(Settings settings, WatcherClientProxy client) {
|
||||
super(Loggers.getLogger(ExecutableEmailAction.class, settings));
|
||||
this.client = client;
|
||||
this.defaultTimeout = settings.getAsTime("watcher.actions.index.default_timeout", null);
|
||||
this.defaultTimeout = settings.getAsTime("xpack.watcher.actions.index.default_timeout", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@ import org.elasticsearch.watcher.support.http.HttpClient;
|
|||
public class InternalPagerDutyService extends AbstractLifecycleComponent<PagerDutyService> implements PagerDutyService {
|
||||
|
||||
public static final Setting<Settings> PAGERDUTY_ACCOUNT_SETTING =
|
||||
Setting.groupSetting("watcher.actions.pagerduty.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
Setting.groupSetting("xpack.watcher.actions.pagerduty.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
|
||||
private final HttpClient httpClient;
|
||||
private volatile PagerDutyAccounts accounts;
|
||||
|
|
|
@ -19,7 +19,7 @@ public class InternalSlackService extends AbstractLifecycleComponent<SlackServic
|
|||
|
||||
private final HttpClient httpClient;
|
||||
public static final Setting<Settings> SLACK_ACCOUNT_SETTING =
|
||||
Setting.groupSetting("watcher.actions.slack.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
Setting.groupSetting("xpack.watcher.actions.slack.service.", Setting.Property.Dynamic, Setting.Property.NodeScope);
|
||||
private volatile SlackAccounts accounts;
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -45,7 +45,7 @@ import static org.elasticsearch.common.logging.LoggerMessageFormat.format;
|
|||
public class ExecutionService extends AbstractComponent {
|
||||
|
||||
private static final TimeValue DEFAULT_MAX_STOP_TIMEOUT = new TimeValue(30, TimeUnit.SECONDS);
|
||||
private static final String DEFAULT_MAX_STOP_TIMEOUT_SETTING = "watcher.stop.timeout";
|
||||
private static final String DEFAULT_MAX_STOP_TIMEOUT_SETTING = "xpack.watcher.stop.timeout";
|
||||
|
||||
private final HistoryStore historyStore;
|
||||
private final TriggeredWatchStore triggeredWatchStore;
|
||||
|
@ -70,10 +70,10 @@ public class ExecutionService extends AbstractComponent {
|
|||
this.watchStore = watchStore;
|
||||
this.watchLockService = watchLockService;
|
||||
this.clock = clock;
|
||||
this.defaultThrottlePeriod = settings.getAsTime("watcher.execution.default_throttle_period", TimeValue.timeValueSeconds(5));
|
||||
this.defaultThrottlePeriod = settings.getAsTime("xpack.watcher.execution.default_throttle_period", TimeValue.timeValueSeconds(5));
|
||||
maxStopTimeout = settings.getAsTime(DEFAULT_MAX_STOP_TIMEOUT_SETTING, DEFAULT_MAX_STOP_TIMEOUT);
|
||||
if (ExecutionService.this.defaultThrottlePeriod.millis() < 0) {
|
||||
settingsValidation.addError("watcher.execution.default_throttle_period", "time value cannot be negative");
|
||||
settingsValidation.addError("xpack.watcher.execution.default_throttle_period", "time value cannot be negative");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,9 @@ public class TriggeredWatchStore extends AbstractComponent {
|
|||
@Inject
|
||||
public TriggeredWatchStore(Settings settings, WatcherClientProxy client, TriggeredWatch.Parser triggeredWatchParser) {
|
||||
super(settings);
|
||||
this.scrollSize = settings.getAsInt("watcher.execution.scroll.size", 100);
|
||||
this.scrollSize = settings.getAsInt("xpack.watcher.execution.scroll.size", 100);
|
||||
this.client = client;
|
||||
this.scrollTimeout = settings.getAsTime("watcher.execution.scroll.timeout", TimeValue.timeValueSeconds(30));
|
||||
this.scrollTimeout = settings.getAsTime("xpack.watcher.execution.scroll.timeout", TimeValue.timeValueSeconds(30));
|
||||
this.triggeredWatchParser = triggeredWatchParser;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class SearchInputFactory extends InputFactory<SearchInput, SearchInput.Re
|
|||
this.queryRegistry = queryRegistry;
|
||||
this.aggParsers = aggParsers;
|
||||
this.suggesters = suggesters;
|
||||
this.defaultTimeout = settings.getAsTime("watcher.input.search.default_timeout", null);
|
||||
this.defaultTimeout = settings.getAsTime("xpack.watcher.input.search.default_timeout", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.elasticsearch.watcher.watch.WatchStore;
|
|||
/**
|
||||
*/
|
||||
public class RestHijackOperationAction extends WatcherRestHandler {
|
||||
private static String ALLOW_DIRECT_ACCESS_TO_WATCH_INDEX_SETTING = "watcher.index.rest.direct_access";
|
||||
private static String ALLOW_DIRECT_ACCESS_TO_WATCH_INDEX_SETTING = "xpack.watcher.index.rest.direct_access";
|
||||
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -48,8 +48,8 @@ import java.util.Map;
|
|||
*/
|
||||
public class HttpClient extends AbstractLifecycleComponent<HttpClient> {
|
||||
|
||||
static final String SETTINGS_SSL_PREFIX = "watcher.http.ssl.";
|
||||
static final String SETTINGS_PROXY_PREFIX = "watcher.http.proxy.";
|
||||
static final String SETTINGS_SSL_PREFIX = "xpack.watcher.http.ssl.";
|
||||
static final String SETTINGS_PROXY_PREFIX = "xpack.watcher.http.proxy.";
|
||||
static final String SETTINGS_SSL_SHIELD_PREFIX = "xpack.security.ssl.";
|
||||
|
||||
public static final String SETTINGS_SSL_PROTOCOL = SETTINGS_SSL_PREFIX + "protocol";
|
||||
|
@ -84,8 +84,8 @@ public class HttpClient extends AbstractLifecycleComponent<HttpClient> {
|
|||
super(settings);
|
||||
this.httpAuthRegistry = httpAuthRegistry;
|
||||
this.env = env;
|
||||
defaultConnectionTimeout = settings.getAsTime("watcher.http.default_connection_timeout", TimeValue.timeValueSeconds(10));
|
||||
defaultReadTimeout = settings.getAsTime("watcher.http.default_read_timeout", TimeValue.timeValueSeconds(10));
|
||||
defaultConnectionTimeout = settings.getAsTime("xpack.watcher.http.default_connection_timeout", TimeValue.timeValueSeconds(10));
|
||||
defaultReadTimeout = settings.getAsTime("xpack.watcher.http.default_read_timeout", TimeValue.timeValueSeconds(10));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,9 +42,9 @@ public class WatcherClientProxy extends ClientProxy {
|
|||
|
||||
@Inject
|
||||
public WatcherClientProxy(Settings settings) {
|
||||
defaultSearchTimeout = settings.getAsTime("watcher.internal.ops.search.default_timeout", TimeValue.timeValueSeconds(30));
|
||||
defaultIndexTimeout = settings.getAsTime("watcher.internal.ops.index.default_timeout", TimeValue.timeValueSeconds(60));
|
||||
defaultBulkTimeout = settings.getAsTime("watcher.internal.ops.bulk.default_timeout", TimeValue.timeValueSeconds(120));
|
||||
defaultSearchTimeout = settings.getAsTime("xpack.watcher.internal.ops.search.default_timeout", TimeValue.timeValueSeconds(30));
|
||||
defaultIndexTimeout = settings.getAsTime("xpack.watcher.internal.ops.index.default_timeout", TimeValue.timeValueSeconds(60));
|
||||
defaultBulkTimeout = settings.getAsTime("xpack.watcher.internal.ops.bulk.default_timeout", TimeValue.timeValueSeconds(120));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,7 +46,7 @@ public interface SecretService {
|
|||
private final CryptoService cryptoService;
|
||||
private final boolean encryptSensitiveData;
|
||||
public static final Setting<Boolean> ENCRYPT_SENSITIVE_DATA_SETTING =
|
||||
Setting.boolSetting("watcher.shield.encrypt_sensitive_data", false, Setting.Property.NodeScope);
|
||||
Setting.boolSetting("xpack.watcher.shield.encrypt_sensitive_data", false, Setting.Property.NodeScope);
|
||||
@Inject
|
||||
public Secure(Settings settings, CryptoService cryptoService) {
|
||||
super(settings);
|
||||
|
|
|
@ -38,7 +38,7 @@ public class SearchTransformFactory extends TransformFactory<SearchTransform, Se
|
|||
this.queryRegistry = queryRegistry;
|
||||
this.aggParsers = aggParsers;
|
||||
this.suggesters = suggesters;
|
||||
this.defaultTimeout = settings.getAsTime("watcher.transform.search.default_timeout", null);
|
||||
this.defaultTimeout = settings.getAsTime("xpack.watcher.transform.search.default_timeout", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -76,7 +76,7 @@ public class ScheduleModule extends AbstractModule {
|
|||
protected abstract Class<? extends TriggerEngine> engineType();
|
||||
|
||||
public static Engine resolve(Settings settings) {
|
||||
String engine = settings.get("watcher.trigger.schedule.engine", "ticker");
|
||||
String engine = settings.get("xpack.watcher.trigger.schedule.engine", "ticker");
|
||||
switch (engine.toLowerCase(Locale.ROOT)) {
|
||||
case "ticker" : return TICKER;
|
||||
case "scheduler" : return SCHEDULER;
|
||||
|
|
|
@ -37,7 +37,7 @@ public class TickerScheduleTriggerEngine extends ScheduleTriggerEngine {
|
|||
@Inject
|
||||
public TickerScheduleTriggerEngine(Settings settings, ScheduleRegistry scheduleRegistry, Clock clock) {
|
||||
super(settings, scheduleRegistry, clock);
|
||||
this.tickInterval = settings.getAsTime("watcher.trigger.schedule.ticker.tick_interval", TimeValue.timeValueMillis(500));
|
||||
this.tickInterval = settings.getAsTime("xpack.watcher.trigger.schedule.ticker.tick_interval", TimeValue.timeValueMillis(500));
|
||||
this.schedules = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ public class WatchLockService extends AbstractComponent {
|
|||
private final FairKeyedLock<String> watchLocks = new FairKeyedLock<>();
|
||||
private final AtomicBoolean running = new AtomicBoolean(false);
|
||||
private static final TimeValue DEFAULT_MAX_STOP_TIMEOUT = new TimeValue(30, TimeUnit.SECONDS);
|
||||
private static final String DEFAULT_MAX_STOP_TIMEOUT_SETTING = "watcher.stop.timeout";
|
||||
private static final String DEFAULT_MAX_STOP_TIMEOUT_SETTING = "xpack.watcher.stop.timeout";
|
||||
|
||||
private final TimeValue maxStopTimeout;
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ public class WatchStore extends AbstractComponent {
|
|||
this.watchParser = watchParser;
|
||||
this.watches = ConcurrentCollections.newConcurrentMap();
|
||||
|
||||
this.scrollTimeout = settings.getAsTime("watcher.watch.scroll.timeout", TimeValue.timeValueSeconds(30));
|
||||
this.scrollSize = settings.getAsInt("watcher.watch.scroll.size", 100);
|
||||
this.scrollTimeout = settings.getAsTime("xpack.watcher.watch.scroll.timeout", TimeValue.timeValueSeconds(30));
|
||||
this.scrollSize = settings.getAsInt("xpack.watcher.watch.scroll.size", 100);
|
||||
}
|
||||
|
||||
public void start(ClusterState state) throws Exception {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"template": ".watcher-history-${watcher.template.version}*",
|
||||
"template": ".watcher-history-${xpack.watcher.template.version}*",
|
||||
"order": 2147483647,
|
||||
"settings": {
|
||||
"watcher.plugin.version": "${watcher.plugin.version}",
|
||||
"watcher.template.version": "${watcher.template.version}",
|
||||
"xpack.watcher.plugin.version": "${xpack.watcher.plugin.version}",
|
||||
"xpack.watcher.template.version": "${xpack.watcher.template.version}",
|
||||
"index.number_of_shards": 1,
|
||||
"index.mapper.dynamic": false
|
||||
},
|
||||
|
|
|
@ -1 +1 @@
|
|||
watcher.template.version=${watcher.template.version}
|
||||
xpack.watcher.template.version=${xpack.watcher.template.version}
|
||||
|
|
|
@ -38,23 +38,24 @@ public class WatcherF {
|
|||
settings.put("cluster.name", WatcherF.class.getSimpleName());
|
||||
|
||||
// this is for the `test-watcher-integration` group level integration in HipChat
|
||||
settings.put("watcher.actions.hipchat.service.account.integration.profile", "integration");
|
||||
settings.put("watcher.actions.hipchat.service.account.integration.auth_token", "huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU");
|
||||
settings.put("watcher.actions.hipchat.service.account.integration.room", "test-watcher");
|
||||
settings.put("xpack.watcher.actions.hipchat.service.account.integration.profile", "integration");
|
||||
settings.put("xpack.watcher.actions.hipchat.service.account.integration.auth_token", "huuS9v7ccuOy3ZBWWWr1vt8Lqu3sQnLUE81nrLZU");
|
||||
settings.put("xpack.watcher.actions.hipchat.service.account.integration.room", "test-watcher");
|
||||
|
||||
// this is for the Watcher Test account in HipChat
|
||||
settings.put("watcher.actions.hipchat.service.account.user.profile", "user");
|
||||
settings.put("watcher.actions.hipchat.service.account.user.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0");
|
||||
settings.put("xpack.watcher.actions.hipchat.service.account.user.profile", "user");
|
||||
settings.put("xpack.watcher.actions.hipchat.service.account.user.auth_token", "FYVx16oDH78ZW9r13wtXbcszyoyA7oX5tiMWg9X0");
|
||||
|
||||
// this is for the `test-watcher-v1` notification token (hipchat)
|
||||
settings.put("watcher.actions.hipchat.service.account.v1.profile", "v1");
|
||||
settings.put("watcher.actions.hipchat.service.account.v1.auth_token", "a734baf62df618b96dda55b323fc30");
|
||||
settings.put("xpack.watcher.actions.hipchat.service.account.v1.profile", "v1");
|
||||
settings.put("xpack.watcher.actions.hipchat.service.account.v1.auth_token", "a734baf62df618b96dda55b323fc30");
|
||||
|
||||
// this is for our test slack incoming webhook (under elasticsearch team)
|
||||
System.setProperty("es.watcher.actions.slack.service.account.a1.url",
|
||||
System.setProperty("es.xpack.watcher.actions.slack.service.account.a1.url",
|
||||
"https://hooks.slack.com/services/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");
|
||||
|
||||
System.setProperty("es.watcher.actions.pagerduty.service.account.service1.service_api_key", "fc082467005d4072a914e0bb041882d0");
|
||||
System.setProperty("es.xpack.watcher.actions.pagerduty.service.account.service1.service_api_key",
|
||||
"fc082467005d4072a914e0bb041882d0");
|
||||
|
||||
final CountDownLatch latch = new CountDownLatch(1);
|
||||
final Node node = new MockNode(settings.build(), Version.CURRENT, Arrays.asList(XPackPlugin.class, XPackPlugin.class));
|
||||
|
|
|
@ -93,11 +93,11 @@ public class EmailAttachmentTests extends AbstractWatcherIntegrationTestCase {
|
|||
}
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("watcher.actions.email.service.account.test.smtp.auth", true)
|
||||
.put("watcher.actions.email.service.account.test.smtp.user", USERNAME)
|
||||
.put("watcher.actions.email.service.account.test.smtp.password", PASSWORD)
|
||||
.put("watcher.actions.email.service.account.test.smtp.port", server.port())
|
||||
.put("watcher.actions.email.service.account.test.smtp.host", "localhost")
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.auth", true)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.user", USERNAME)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.password", PASSWORD)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.port", server.port())
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.host", "localhost")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -67,10 +67,10 @@ public class EmailSecretsIntegrationTests extends AbstractWatcherIntegrationTest
|
|||
}
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("watcher.actions.email.service.account.test.smtp.auth", true)
|
||||
.put("watcher.actions.email.service.account.test.smtp.port", server.port())
|
||||
.put("watcher.actions.email.service.account.test.smtp.host", "localhost")
|
||||
.put("watcher.shield.encrypt_sensitive_data", encryptSensitiveData)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.auth", true)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.port", server.port())
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.host", "localhost")
|
||||
.put("xpack.watcher.shield.encrypt_sensitive_data", encryptSensitiveData)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ public class HtmlSanitizerTests extends ESTestCase {
|
|||
public void testCustomDisabled() {
|
||||
String html = "<img src=\"http://test.com/nastyimage.jpg\" />This is a bad image";
|
||||
HtmlSanitizer sanitizer = new HtmlSanitizer(Settings.builder()
|
||||
.put("watcher.actions.email.html.sanitization.enabled", false)
|
||||
.put("xpack.watcher.actions.email.html.sanitization.enabled", false)
|
||||
.build());
|
||||
String sanitizedHtml = sanitizer.sanitize(html);
|
||||
assertThat(sanitizedHtml, equalTo(html));
|
||||
|
@ -132,7 +132,7 @@ public class HtmlSanitizerTests extends ESTestCase {
|
|||
public void testCustomAllImageAllowed() {
|
||||
String html = "<img src=\"http://test.com/nastyimage.jpg\" />This is a bad image";
|
||||
HtmlSanitizer sanitizer = new HtmlSanitizer(Settings.builder()
|
||||
.put("watcher.actions.email.html.sanitization.allow", "img:all")
|
||||
.put("xpack.watcher.actions.email.html.sanitization.allow", "img:all")
|
||||
.build());
|
||||
String sanitizedHtml = sanitizer.sanitize(html);
|
||||
assertThat(sanitizedHtml, equalTo(html));
|
||||
|
@ -141,7 +141,7 @@ public class HtmlSanitizerTests extends ESTestCase {
|
|||
public void testCustomTablesDisallowed() {
|
||||
String html = "<table><tr><td>cell1</td><td>cell2</td></tr></table>";
|
||||
HtmlSanitizer sanitizer = new HtmlSanitizer(Settings.builder()
|
||||
.put("watcher.actions.email.html.sanitization.disallow", "_tables")
|
||||
.put("xpack.watcher.actions.email.html.sanitization.disallow", "_tables")
|
||||
.build());
|
||||
String sanitizedHtml = sanitizer.sanitize(html);
|
||||
assertThat(sanitizedHtml, equalTo("cell1cell2"));
|
||||
|
|
|
@ -26,13 +26,13 @@ public class ManualPublicSmtpServersTester {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
test(Profile.GMAIL, Settings.builder()
|
||||
.put("watcher.actions.email.service.account.gmail.smtp.auth", true)
|
||||
.put("watcher.actions.email.service.account.gmail.smtp.starttls.enable", true)
|
||||
.put("watcher.actions.email.service.account.gmail.smtp.host", "smtp.gmail.com")
|
||||
.put("watcher.actions.email.service.account.gmail.smtp.port", 587)
|
||||
.put("watcher.actions.email.service.account.gmail.smtp.user", terminal.readText("username: "))
|
||||
.put("watcher.actions.email.service.account.gmail.smtp.password", new String(terminal.readSecret("password: ")))
|
||||
.put("watcher.actions.email.service.account.gmail.email_defaults.to", terminal.readText("to: "))
|
||||
.put("xpack.watcher.actions.email.service.account.gmail.smtp.auth", true)
|
||||
.put("xpack.watcher.actions.email.service.account.gmail.smtp.starttls.enable", true)
|
||||
.put("xpack.watcher.actions.email.service.account.gmail.smtp.host", "smtp.gmail.com")
|
||||
.put("xpack.watcher.actions.email.service.account.gmail.smtp.port", 587)
|
||||
.put("xpack.watcher.actions.email.service.account.gmail.smtp.user", terminal.readText("username: "))
|
||||
.put("xpack.watcher.actions.email.service.account.gmail.smtp.password", new String(terminal.readSecret("password: ")))
|
||||
.put("xpack.watcher.actions.email.service.account.gmail.email_defaults.to", terminal.readText("to: "))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -41,13 +41,13 @@ public class ManualPublicSmtpServersTester {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
test(Profile.STANDARD, Settings.builder()
|
||||
.put("watcher.actions.email.service.account.outlook.smtp.auth", true)
|
||||
.put("watcher.actions.email.service.account.outlook.smtp.starttls.enable", true)
|
||||
.put("watcher.actions.email.service.account.outlook.smtp.host", "smtp-mail.outlook.com")
|
||||
.put("watcher.actions.email.service.account.outlook.smtp.port", 587)
|
||||
.put("watcher.actions.email.service.account.outlook.smtp.user", "elastic.user@outlook.com")
|
||||
.put("watcher.actions.email.service.account.outlook.smtp.password", "fantastic42")
|
||||
.put("watcher.actions.email.service.account.outlook.email_defaults.to", "elastic.user@outlook.com")
|
||||
.put("xpack.watcher.actions.email.service.account.outlook.smtp.auth", true)
|
||||
.put("xpack.watcher.actions.email.service.account.outlook.smtp.starttls.enable", true)
|
||||
.put("xpack.watcher.actions.email.service.account.outlook.smtp.host", "smtp-mail.outlook.com")
|
||||
.put("xpack.watcher.actions.email.service.account.outlook.smtp.port", 587)
|
||||
.put("xpack.watcher.actions.email.service.account.outlook.smtp.user", "elastic.user@outlook.com")
|
||||
.put("xpack.watcher.actions.email.service.account.outlook.smtp.password", "fantastic42")
|
||||
.put("xpack.watcher.actions.email.service.account.outlook.email_defaults.to", "elastic.user@outlook.com")
|
||||
.put()
|
||||
);
|
||||
}
|
||||
|
@ -57,15 +57,15 @@ public class ManualPublicSmtpServersTester {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
test(Profile.STANDARD, Settings.builder()
|
||||
.put("watcher.actions.email.service.account.yahoo.smtp.starttls.enable", true)
|
||||
.put("watcher.actions.email.service.account.yahoo.smtp.auth", true)
|
||||
.put("watcher.actions.email.service.account.yahoo.smtp.host", "smtp.mail.yahoo.com")
|
||||
.put("watcher.actions.email.service.account.yahoo.smtp.port", 587)
|
||||
.put("watcher.actions.email.service.account.yahoo.smtp.user", "elastic.user@yahoo.com")
|
||||
.put("watcher.actions.email.service.account.yahoo.smtp.password", "fantastic42")
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.smtp.starttls.enable", true)
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.smtp.auth", true)
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.smtp.host", "smtp.mail.yahoo.com")
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.smtp.port", 587)
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.smtp.user", "elastic.user@yahoo.com")
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.smtp.password", "fantastic42")
|
||||
// note: from must be set to the same authenticated user account
|
||||
.put("watcher.actions.email.service.account.yahoo.email_defaults.from", "elastic.user@yahoo.com")
|
||||
.put("watcher.actions.email.service.account.yahoo.email_defaults.to", "elastic.user@yahoo.com")
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.email_defaults.from", "elastic.user@yahoo.com")
|
||||
.put("xpack.watcher.actions.email.service.account.yahoo.email_defaults.to", "elastic.user@yahoo.com")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -75,15 +75,16 @@ public class ManualPublicSmtpServersTester {
|
|||
|
||||
public static void main(String[] args) throws Exception {
|
||||
test(Profile.STANDARD, Settings.builder()
|
||||
.put("watcher.actions.email.service.account.ses.smtp.auth", true)
|
||||
.put("watcher.actions.email.service.account.ses.smtp.starttls.enable", true)
|
||||
.put("watcher.actions.email.service.account.ses.smtp.starttls.required", true)
|
||||
.put("watcher.actions.email.service.account.ses.smtp.host", "email-smtp.us-east-1.amazonaws.com")
|
||||
.put("watcher.actions.email.service.account.ses.smtp.port", 587)
|
||||
.put("watcher.actions.email.service.account.ses.smtp.user", terminal.readText("user: "))
|
||||
.put("watcher.actions.email.service.account.ses.smtp.password", new String(terminal.readSecret("password: ")))
|
||||
.put("watcher.actions.email.service.account.ses.email_defaults.from", "dummy.user@elasticsearch.com")
|
||||
.put("watcher.actions.email.service.account.ses.email_defaults.to", terminal.readText("to: "))
|
||||
.put("xpack.watcher.actions.email.service.account.ses.smtp.auth", true)
|
||||
.put("xpack.watcher.actions.email.service.account.ses.smtp.starttls.enable", true)
|
||||
.put("xpack.watcher.actions.email.service.account.ses.smtp.starttls.required", true)
|
||||
.put("xpack.watcher.actions.email.service.account.ses.smtp.host", "email-smtp.us-east-1.amazonaws.com")
|
||||
.put("xpack.watcher.actions.email.service.account.ses.smtp.port", 587)
|
||||
.put("xpack.watcher.actions.email.service.account.ses.smtp.user", terminal.readText("user: "))
|
||||
.put("xpack.watcher.actions.email.service.account.ses.email_defaults.from", "dummy.user@elasticsearch.com")
|
||||
.put("xpack.watcher.actions.email.service.account.ses.email_defaults.to", terminal.readText("to: "))
|
||||
.put("xpack.watcher.actions.email.service.account.ses.smtp.password",
|
||||
new String(terminal.readSecret("password: ")))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,13 +46,13 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
|||
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
||||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||
Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.V1.value())
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token");
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.V1.value())
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token");
|
||||
if (host != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + accountName + ".host", host);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".host", host);
|
||||
}
|
||||
if (port > 0) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + accountName + ".port", port);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".port", port);
|
||||
}
|
||||
buildMessageDefaults(accountName, settingsBuilder, defaultRoom, null, defaultFrom, defaultColor, defaultFormat, defaultNotify);
|
||||
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||
|
@ -93,14 +93,15 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
|||
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
||||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||
Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.INTEGRATION.value())
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token")
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".room", room);
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".profile",
|
||||
HipChatAccount.Profile.INTEGRATION.value())
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token")
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".room", room);
|
||||
if (host != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + accountName + ".host", host);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".host", host);
|
||||
}
|
||||
if (port > 0) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + accountName + ".port", port);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".port", port);
|
||||
}
|
||||
buildMessageDefaults(accountName, settingsBuilder, null, null, defaultFrom, defaultColor, defaultFormat, defaultNotify);
|
||||
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||
|
@ -129,8 +130,9 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
|||
public void testSingleAccountIntegrationNoRoomSetting() throws Exception {
|
||||
String accountName = randomAsciiOfLength(10);
|
||||
Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.INTEGRATION.value())
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token");
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".profile",
|
||||
HipChatAccount.Profile.INTEGRATION.value())
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token");
|
||||
try (InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||
new ClusterSettings(settingsBuilder.build(), Collections.singleton(InternalHipChatService.HIPCHAT_ACCOUNT_SETTING)))) {
|
||||
service.start();
|
||||
|
@ -150,13 +152,13 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
|||
HipChatMessage.Format defaultFormat = randomBoolean() ? null : randomFrom(HipChatMessage.Format.values());
|
||||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||
Settings.Builder settingsBuilder = Settings.builder()
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.USER.value())
|
||||
.put("watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token");
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".profile", HipChatAccount.Profile.USER.value())
|
||||
.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".auth_token", "_token");
|
||||
if (host != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + accountName + ".host", host);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".host", host);
|
||||
}
|
||||
if (port > 0) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + accountName + ".port", port);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + accountName + ".port", port);
|
||||
}
|
||||
buildMessageDefaults(accountName, settingsBuilder, defaultRoom, defaultUser, null, defaultColor, defaultFormat, defaultNotify);
|
||||
InternalHipChatService service = new InternalHipChatService(settingsBuilder.build(), httpClient,
|
||||
|
@ -197,17 +199,17 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
|||
Boolean defaultNotify = randomBoolean() ? null : (Boolean) randomBoolean();
|
||||
Settings.Builder settingsBuilder = Settings.builder();
|
||||
String defaultAccount = "_a" + randomIntBetween(0, 4);
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.default_account", defaultAccount);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.default_account", defaultAccount);
|
||||
|
||||
boolean customGlobalServer = randomBoolean();
|
||||
if (customGlobalServer) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.host", "_host_global");
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.port", 299);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.host", "_host_global");
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.port", 299);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
String name = "_a" + i;
|
||||
String prefix = "watcher.actions.hipchat.service.account." + name;
|
||||
String prefix = "xpack.watcher.actions.hipchat.service.account." + name;
|
||||
HipChatAccount.Profile profile = randomFrom(HipChatAccount.Profile.values());
|
||||
settingsBuilder.put(prefix + ".profile", profile);
|
||||
settingsBuilder.put(prefix + ".auth_token", "_token" + i);
|
||||
|
@ -256,22 +258,22 @@ public class InternalHipChatServiceTests extends ESTestCase {
|
|||
private void buildMessageDefaults(String account, Settings.Builder settingsBuilder, String room, String user, String from,
|
||||
HipChatMessage.Color color, HipChatMessage.Format format, Boolean notify) {
|
||||
if (room != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + account + ".message_defaults.room", room);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + account + ".message_defaults.room", room);
|
||||
}
|
||||
if (user != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + account + ".message_defaults.user", user);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + account + ".message_defaults.user", user);
|
||||
}
|
||||
if (from != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + account + ".message_defaults.from", from);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + account + ".message_defaults.from", from);
|
||||
}
|
||||
if (color != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + account + ".message_defaults.color", color.value());
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + account + ".message_defaults.color", color.value());
|
||||
}
|
||||
if (format != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + account + ".message_defaults.format", format);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + account + ".message_defaults.format", format);
|
||||
}
|
||||
if (notify != null) {
|
||||
settingsBuilder.put("watcher.actions.hipchat.service.account." + account + ".message_defaults.notify", notify);
|
||||
settingsBuilder.put("xpack.watcher.actions.hipchat.service.account." + account + ".message_defaults.notify", notify);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@ public class HistoryStoreSettingsTests extends AbstractWatcherIntegrationTestCas
|
|||
assertAcked(
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(Settings.builder()
|
||||
.put("watcher.history.index.number_of_shards", "2")
|
||||
.put("watcher.history.index.number_of_replicas", "2")
|
||||
.put("watcher.history.index.refresh_interval", "5m"))
|
||||
.put("xpack.watcher.history.index.number_of_shards", "2")
|
||||
.put("xpack.watcher.history.index.number_of_replicas", "2")
|
||||
.put("xpack.watcher.history.index.refresh_interval", "5m"))
|
||||
.get()
|
||||
);
|
||||
|
||||
|
@ -60,8 +60,8 @@ public class HistoryStoreSettingsTests extends AbstractWatcherIntegrationTestCas
|
|||
assertAcked(
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(Settings.builder()
|
||||
.put("watcher.history.index.number_of_shards", "2")
|
||||
.put("watcher.history.index.mapper.dynamic", true)) // forbidden setting, should not get updated
|
||||
.put("xpack.watcher.history.index.number_of_shards", "2")
|
||||
.put("xpack.watcher.history.index.mapper.dynamic", true)) // forbidden setting, should not get updated
|
||||
.get()
|
||||
);
|
||||
|
||||
|
|
|
@ -62,11 +62,11 @@ public class HistoryTemplateEmailMappingsTests extends AbstractWatcherIntegratio
|
|||
.put(super.nodeSettings(nodeOrdinal))
|
||||
|
||||
// email
|
||||
.put("watcher.actions.email.service.account.test.smtp.auth", true)
|
||||
.put("watcher.actions.email.service.account.test.smtp.user", USERNAME)
|
||||
.put("watcher.actions.email.service.account.test.smtp.password", PASSWORD)
|
||||
.put("watcher.actions.email.service.account.test.smtp.port", server.port())
|
||||
.put("watcher.actions.email.service.account.test.smtp.host", "localhost")
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.auth", true)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.user", USERNAME)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.password", PASSWORD)
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.port", server.port())
|
||||
.put("xpack.watcher.actions.email.service.account.test.smtp.host", "localhost")
|
||||
|
||||
.build();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class WatcherIndexTemplateRegistryTests extends AbstractWatcherIntegratio
|
|||
assertAcked(
|
||||
client().admin().cluster().prepareUpdateSettings()
|
||||
.setTransientSettings(Settings.builder()
|
||||
.put("watcher.history.index.key1", "value"))
|
||||
.put("xpack.watcher.history.index.key1", "value"))
|
||||
.get()
|
||||
);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ public class HttpConnectionTimeoutTests extends ESTestCase {
|
|||
public void testDefaultTimeoutCustom() throws Exception {
|
||||
Environment environment = new Environment(Settings.builder().put("path.home", createTempDir()).build());
|
||||
HttpClient httpClient = new HttpClient(Settings.builder()
|
||||
.put("watcher.http.default_connection_timeout", "5s")
|
||||
.put("xpack.watcher.http.default_connection_timeout", "5s")
|
||||
.build()
|
||||
, mock(HttpAuthRegistry.class), environment).start();
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class HttpConnectionTimeoutTests extends ESTestCase {
|
|||
public void testTimeoutCustomPerRequest() throws Exception {
|
||||
Environment environment = new Environment(Settings.builder().put("path.home", createTempDir()).build());
|
||||
HttpClient httpClient = new HttpClient(Settings.builder()
|
||||
.put("watcher.http.default_connection_timeout", "10s")
|
||||
.put("xpack.watcher.http.default_connection_timeout", "10s")
|
||||
.build()
|
||||
, mock(HttpAuthRegistry.class), environment).start();
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public class HttpReadTimeoutTests extends ESTestCase {
|
|||
Environment environment = new Environment(Settings.builder().put("path.home", createTempDir()).build());
|
||||
|
||||
HttpClient httpClient = new HttpClient(Settings.builder()
|
||||
.put("watcher.http.default_read_timeout", "3s")
|
||||
.put("xpack.watcher.http.default_read_timeout", "3s")
|
||||
.build()
|
||||
, mock(HttpAuthRegistry.class), environment).start();
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class HttpReadTimeoutTests extends ESTestCase {
|
|||
Environment environment = new Environment(Settings.builder().put("path.home", createTempDir()).build());
|
||||
|
||||
HttpClient httpClient = new HttpClient(Settings.builder()
|
||||
.put("watcher.http.default_read_timeout", "10s")
|
||||
.put("xpack.watcher.http.default_read_timeout", "10s")
|
||||
.build()
|
||||
, mock(HttpAuthRegistry.class), environment).start();
|
||||
|
||||
|
|
|
@ -133,10 +133,10 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
|
|||
.put(XPackPlugin.featureEnabledSetting(Marvel.NAME), false)
|
||||
// we do this by default in core, but for watcher this isn't needed and only adds noise.
|
||||
.put("index.store.mock.check_index_on_close", false)
|
||||
.put("watcher.execution.scroll.size", randomIntBetween(1, 100))
|
||||
.put("watcher.watch.scroll.size", randomIntBetween(1, 100))
|
||||
.put("xpack.watcher.execution.scroll.size", randomIntBetween(1, 100))
|
||||
.put("xpack.watcher.watch.scroll.size", randomIntBetween(1, 100))
|
||||
.put(ShieldSettings.settings(shieldEnabled))
|
||||
.put("watcher.trigger.schedule.engine", scheduleImplName)
|
||||
.put("xpack.watcher.trigger.schedule.engine", scheduleImplName)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public class WatcherScheduleEngineBenchmark {
|
|||
System.gc();
|
||||
Settings settings = Settings.builder()
|
||||
.put(SETTINGS)
|
||||
.put("watcher.trigger.schedule.engine", engine)
|
||||
.put("xpack.watcher.trigger.schedule.engine", engine)
|
||||
.put("node.data", false)
|
||||
.build();
|
||||
try (Node node = new MockNode(settings, Version.CURRENT, Arrays.asList(XPackPlugin.class, XPackPlugin.class))) {
|
||||
|
|
|
@ -88,7 +88,7 @@ public class HttpSecretsIntegrationTests extends AbstractWatcherIntegrationTestC
|
|||
if (encryptSensitiveData) {
|
||||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put("watcher.shield.encrypt_sensitive_data", encryptSensitiveData)
|
||||
.put("xpack.watcher.shield.encrypt_sensitive_data", encryptSensitiveData)
|
||||
.build();
|
||||
}
|
||||
return super.nodeSettings(nodeOrdinal);
|
||||
|
|
|
@ -45,10 +45,10 @@ public class WatcherSettingsFilterTests extends AbstractWatcherIntegrationTestCa
|
|||
return Settings.builder()
|
||||
.put(super.nodeSettings(nodeOrdinal))
|
||||
.put(NetworkModule.HTTP_ENABLED.getKey(), true)
|
||||
.put("watcher.actions.email.service.account._email.smtp.host", "host.domain")
|
||||
.put("watcher.actions.email.service.account._email.smtp.port", 587)
|
||||
.put("watcher.actions.email.service.account._email.smtp.user", "_user")
|
||||
.put("watcher.actions.email.service.account._email.smtp.password", "_passwd")
|
||||
.put("xpack.watcher.actions.email.service.account._email.smtp.host", "host.domain")
|
||||
.put("xpack.watcher.actions.email.service.account._email.smtp.port", 587)
|
||||
.put("xpack.watcher.actions.email.service.account._email.smtp.user", "_user")
|
||||
.put("xpack.watcher.actions.email.service.account._email.smtp.password", "_passwd")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -58,9 +58,10 @@ public class WatcherSettingsFilterTests extends AbstractWatcherIntegrationTestCa
|
|||
Map<String, Object> nodes = (Map<String, Object>) response.get("nodes");
|
||||
for (Object node : nodes.values()) {
|
||||
Map<String, Object> settings = (Map<String, Object>) ((Map<String, Object>) node).get("settings");
|
||||
assertThat(XContentMapValues.extractValue("watcher.actions.email.service.account._email.smtp.user", settings),
|
||||
assertThat(XContentMapValues.extractValue("xpack.watcher.actions.email.service.account._email.smtp.user", settings),
|
||||
is((Object) "_user"));
|
||||
assertThat(XContentMapValues.extractValue("watcher.actions.email.service.account._email.smtp.password", settings), nullValue());
|
||||
assertThat(XContentMapValues.extractValue("xpack.watcher.actions.email.service.account._email.smtp.password", settings),
|
||||
nullValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue