azkaban-aplcache
Changes
build.gradle 5(+5 -0)
Details
diff --git a/azkaban-common/src/main/java/azkaban/utils/AbstractMailer.java b/azkaban-common/src/main/java/azkaban/utils/AbstractMailer.java
index 39769c7..bbbec14 100644
--- a/azkaban-common/src/main/java/azkaban/utils/AbstractMailer.java
+++ b/azkaban-common/src/main/java/azkaban/utils/AbstractMailer.java
@@ -23,6 +23,7 @@ public class AbstractMailer {
private String clientHostname;
private int clientPort;
private boolean usesSSL;
+ private boolean usesAuth;
private String mailHost;
private String mailUser;
@@ -45,6 +46,7 @@ public class AbstractMailer {
attachmentMazSizeInByte = maxAttachmentSizeInMB * MB_IN_BYTES;
this.mailSender = props.getString("mail.sender", "");
+ this.usesAuth = props.getBoolean("mail.useAuth", true);
this.clientHostname = props.get("server.hostname");
this.clientPort = props.getInt("server.port");
@@ -72,6 +74,7 @@ public class AbstractMailer {
message.addAllToAddress(emailList);
message.setMimeType(mimetype);
message.setSubject(subject);
+ message.setAuth(usesAuth);
return message;
}
@@ -109,4 +112,8 @@ public class AbstractMailer {
public long getAttachmentMaxSize() {
return attachmentMazSizeInByte;
}
+
+ public boolean hasMailAuth() {
+ return usesAuth;
+ }
}
diff --git a/azkaban-common/src/main/java/azkaban/utils/Emailer.java b/azkaban-common/src/main/java/azkaban/utils/Emailer.java
index 48468bc..798d920 100644
--- a/azkaban-common/src/main/java/azkaban/utils/Emailer.java
+++ b/azkaban-common/src/main/java/azkaban/utils/Emailer.java
@@ -60,7 +60,7 @@ public class Emailer extends AbstractMailer implements Alerter {
this.mailPassword = props.getString("mail.password", "");
this.mailSender = props.getString("mail.sender", "");
this.tls = props.getString("mail.tls", "false");
-
+
int mailTimeout = props.getInt("mail.timeout.millis", 10000);
EmailMessage.setTimeout(mailTimeout);
int connectionTimeout =
@@ -108,6 +108,7 @@ public class Emailer extends AbstractMailer implements Alerter {
EmailMessage message = new EmailMessage(mailHost, mailUser, mailPassword);
message.setFromAddress(mailSender);
message.setTLS(tls);
+ message.setAuth(super.hasMailAuth());
ExecutionOptions option = flow.getExecutionOptions();
@@ -134,7 +135,8 @@ public class Emailer extends AbstractMailer implements Alerter {
EmailMessage message = new EmailMessage(mailHost, mailUser, mailPassword);
message.setFromAddress(mailSender);
message.setTLS(tls);
-
+ message.setAuth(super.hasMailAuth());
+
ExecutionOptions option = flow.getExecutionOptions();
MailCreator mailCreator =
@@ -159,7 +161,8 @@ public class Emailer extends AbstractMailer implements Alerter {
EmailMessage message = new EmailMessage(mailHost, mailUser, mailPassword);
message.setFromAddress(mailSender);
message.setTLS(tls);
-
+ message.setAuth(super.hasMailAuth());
+
ExecutionOptions option = flow.getExecutionOptions();
MailCreator mailCreator =
diff --git a/azkaban-common/src/main/java/azkaban/utils/EmailMessage.java b/azkaban-common/src/main/java/azkaban/utils/EmailMessage.java
index 9646184..aca007c 100644
--- a/azkaban-common/src/main/java/azkaban/utils/EmailMessage.java
+++ b/azkaban-common/src/main/java/azkaban/utils/EmailMessage.java
@@ -54,7 +54,7 @@ public class EmailMessage {
private String _mimeType = "text/plain";
private String _tls;
private long _totalAttachmentSizeSoFar;
-
+ private boolean _usesAuth = true;
private StringBuffer _body = new StringBuffer();
private static int _mailTimeout = 10000;
private static int _connectionTimeout = 10000;
@@ -129,6 +129,11 @@ public class EmailMessage {
return this;
}
+ public EmailMessage setAuth(boolean auth) {
+ _usesAuth = auth;
+ return this;
+ }
+
public EmailMessage addAttachment(File file) throws MessagingException {
return addAttachment(file.getName(), file);
}
@@ -182,10 +187,14 @@ public class EmailMessage {
public void sendEmail() throws MessagingException {
checkSettings();
Properties props = new Properties();
+ if (_usesAuth) {
+ props.put("mail." + protocol + ".auth", "true");
+ props.put("mail.user", _mailUser);
+ props.put("mail.password", _mailPassword);
+ } else {
+ props.put("mail." + protocol + ".auth", "false");
+ }
props.put("mail." + protocol + ".host", _mailHost);
- props.put("mail." + protocol + ".auth", "true");
- props.put("mail.user", _mailUser);
- props.put("mail.password", _mailPassword);
props.put("mail." + protocol + ".timeout", _mailTimeout);
props.put("mail." + protocol + ".connectiontimeout", _connectionTimeout);
props.put("mail.smtp.starttls.enable", _tls);
@@ -221,13 +230,14 @@ public class EmailMessage {
// Transport transport = session.getTransport();
SMTPTransport t = (SMTPTransport) session.getTransport(protocol);
+
try {
- t.connect(_mailHost, _mailUser, _mailPassword);
+ connectToSMTPServer(t);
} catch (MessagingException ste) {
if (ste.getCause() instanceof SocketTimeoutException) {
try {
// retry on SocketTimeoutException
- t.connect(_mailHost, _mailUser, _mailPassword);
+ connectToSMTPServer(t);
logger.info("Email retry on SocketTimeoutException succeeded");
} catch (MessagingException me) {
logger.error("Email retry on SocketTimeoutException failed", me);
@@ -242,6 +252,14 @@ public class EmailMessage {
t.close();
}
+ private void connectToSMTPServer(SMTPTransport t) throws MessagingException {
+ if (_usesAuth) {
+ t.connect(_mailHost, _mailUser, _mailPassword);
+ } else {
+ t.connect();
+ }
+ }
+
public void setBody(String body) {
setBody(body, _mimeType);
}
build.gradle 5(+5 -0)
diff --git a/build.gradle b/build.gradle
index 9d6a9b7..95dcd85 100644
--- a/build.gradle
+++ b/build.gradle
@@ -528,22 +528,27 @@ distributions {
// the dist tasks.
migrationDistTar.dependsOn ':azkaban-common:build', ':azkaban-migration:copy'
+migrationDistTar.compression = Compression.GZIP
migrationDistTar.extension = 'tar.gz'
migrationDistZip.dependsOn ':azkaban-common:build', ':azkaban-migration:copy'
webserverDistTar.dependsOn ':azkaban-common:build', ':azkaban-webserver:copy'
+webserverDistTar.compression = Compression.GZIP
webserverDistTar.extension = 'tar.gz'
webserverDistZip.dependsOn ':azkaban-common:build', ':azkaban-webserver:copy'
execserverDistTar.dependsOn ':azkaban-common:build', ':azkaban-execserver:copy'
+execserverDistTar.compression = Compression.GZIP
execserverDistTar.extension = 'tar.gz'
execserverDistZip.dependsOn ':azkaban-common:build', ':azkaban-execserver:copy'
soloserverDistTar.dependsOn ':azkaban-common:build', ':azkaban-soloserver:copy'
+soloserverDistTar.compression = Compression.GZIP
soloserverDistTar.extension = 'tar.gz'
soloserverDistZip.dependsOn ':azkaban-common:build', ':azkaban-soloserver:copy'
sqlDistTar.dependsOn ':azkaban-sql:concat'
+sqlDistTar.compression = Compression.GZIP
sqlDistTar.extension = 'tar.gz'
sqlDistZip.dependsOn ':azkaban-sql:concat'