Move settings checking to the creation of SMTP alert actions.
Original commit: elastic/x-pack-elasticsearch@30da14cb9e
This commit is contained in:
parent
203cf5c024
commit
780c89ec23
|
@ -43,6 +43,15 @@ public class SmtpAlertActionFactory implements AlertActionFactory, ConfigurableC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AlertAction createAction(XContentParser parser) throws IOException {
|
public AlertAction createAction(XContentParser parser) throws IOException {
|
||||||
|
if (settings == null) {
|
||||||
|
settings = configurationManager.getGlobalConfig();
|
||||||
|
configurationManager.registerListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (settings == null) {
|
||||||
|
throw new ElasticsearchException("Unable to retrieve [" + GLOBAL_EMAIL_CONFIG + "] from the config index.");
|
||||||
|
}
|
||||||
|
|
||||||
String display = null;
|
String display = null;
|
||||||
List<String> addresses = new ArrayList<>();
|
List<String> addresses = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -82,15 +91,6 @@ public class SmtpAlertActionFactory implements AlertActionFactory, ConfigurableC
|
||||||
throw new ElasticsearchIllegalStateException("Bad action [" + action.getClass() + "] passed to EmailAlertActionFactory expected [" + SmtpAlertAction.class + "]");
|
throw new ElasticsearchIllegalStateException("Bad action [" + action.getClass() + "] passed to EmailAlertActionFactory expected [" + SmtpAlertAction.class + "]");
|
||||||
}
|
}
|
||||||
SmtpAlertAction smtpAlertAction = (SmtpAlertAction)action;
|
SmtpAlertAction smtpAlertAction = (SmtpAlertAction)action;
|
||||||
if (settings == null) {
|
|
||||||
settings = configurationManager.getGlobalConfig();
|
|
||||||
configurationManager.registerListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (settings == null) {
|
|
||||||
throw new ElasticsearchException("Unable to retrieve [" + GLOBAL_EMAIL_CONFIG + "] from the config index.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
props.put("mail.smtp.auth", "true");
|
props.put("mail.smtp.auth", "true");
|
||||||
|
|
Loading…
Reference in New Issue