Repository: oozie Updated Branches: refs/heads/master ed8ec4f97 -> 38e33811b
OOZIE-2365 oozie fail to start when smtp password not set (rohini) Project: http://git-wip-us.apache.org/repos/asf/oozie/repo Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/38e33811 Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/38e33811 Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/38e33811 Branch: refs/heads/master Commit: 38e33811bc3f9d3b1a1a024dcab6af760734b696 Parents: ed8ec4f Author: Rohini Palaniswamy <[email protected]> Authored: Thu Sep 24 14:25:40 2015 -0700 Committer: Rohini Palaniswamy <[email protected]> Committed: Thu Sep 24 14:25:40 2015 -0700 ---------------------------------------------------------------------- .../oozie/action/email/EmailActionExecutor.java | 6 ++++- .../oozie/service/ConfigurationService.java | 26 +++++++++++++++++--- .../sla/listener/SLAEmailEventListener.java | 7 ++++-- .../apache/oozie/hadoop/utils/HadoopShims.java | 2 +- release-log.txt | 1 + 5 files changed, 35 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oozie/blob/38e33811/core/src/main/java/org/apache/oozie/action/email/EmailActionExecutor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/action/email/EmailActionExecutor.java b/core/src/main/java/org/apache/oozie/action/email/EmailActionExecutor.java index dc58236..7ddbc19 100644 --- a/core/src/main/java/org/apache/oozie/action/email/EmailActionExecutor.java +++ b/core/src/main/java/org/apache/oozie/action/email/EmailActionExecutor.java @@ -168,7 +168,7 @@ public class EmailActionExecutor extends ActionExecutor { String smtpPort = getOozieConf().get(EMAIL_SMTP_PORT, "25"); Boolean smtpAuth = getOozieConf().getBoolean(EMAIL_SMTP_AUTH, false); String smtpUser = getOozieConf().get(EMAIL_SMTP_USER, ""); - String smtpPassword = ConfigurationService.getPassword(EMAIL_SMTP_PASS); + String smtpPassword = ConfigurationService.getPassword(EMAIL_SMTP_PASS, ""); String fromAddr = getOozieConf().get(EMAIL_SMTP_FROM, "oozie@localhost"); Properties properties = new Properties(); @@ -322,18 +322,22 @@ public class EmailActionExecutor extends ActionExecutor { fs = has.createFileSystem(user, uri, fsConf); } + @Override public InputStream getInputStream() throws IOException { return fs.open(new Path(uri)); } + @Override public OutputStream getOutputStream() throws IOException { return fs.create(new Path(uri)); } + @Override public String getContentType() { return "application/octet-stream"; } + @Override public String getName() { return uri.getPath(); } http://git-wip-us.apache.org/repos/asf/oozie/blob/38e33811/core/src/main/java/org/apache/oozie/service/ConfigurationService.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/service/ConfigurationService.java b/core/src/main/java/org/apache/oozie/service/ConfigurationService.java index 4fba996..4246764 100644 --- a/core/src/main/java/org/apache/oozie/service/ConfigurationService.java +++ b/core/src/main/java/org/apache/oozie/service/ConfigurationService.java @@ -148,6 +148,7 @@ public class ConfigurationService implements Service, Instrumentable { * @param services services instance. * @throws ServiceException thrown if the log service could not be initialized. */ + @Override public void init(Services services) throws ServiceException { configDir = getConfigurationDirectory(); configFile = System.getProperty(OOZIE_CONFIG_FILE, SITE_CONFIG_FILE); @@ -179,6 +180,7 @@ public class ConfigurationService implements Service, Instrumentable { /** * Destroy the configuration service. */ + @Override public void destroy() { configuration = null; } @@ -188,6 +190,7 @@ public class ConfigurationService implements Service, Instrumentable { * * @return {@link ConfigurationService}. */ + @Override public Class<? extends Service> getInterface() { return ConfigurationService.class; } @@ -316,11 +319,13 @@ public class ConfigurationService implements Service, Instrumentable { } } + @Override public String[] getStrings(String name) { String s = get(name); return (s != null && s.trim().length() > 0) ? super.getStrings(name) : new String[0]; } + @Override public String[] getStrings(String name, String[] defaultValue) { String s = get(name); if (s == null) { @@ -330,6 +335,7 @@ public class ConfigurationService implements Service, Instrumentable { return (s != null && s.trim().length() > 0) ? super.getStrings(name) : defaultValue; } + @Override public String get(String name, String defaultValue) { String value = get(name); if (value == null) { @@ -341,6 +347,7 @@ public class ConfigurationService implements Service, Instrumentable { return value; } + @Override public void set(String name, String value) { setValue(name, value); boolean maskValue = MASK_PROPS.contains(name); @@ -348,6 +355,7 @@ public class ConfigurationService implements Service, Instrumentable { log.info(XLog.OPS, "Programmatic configuration change, property[{0}]=[{1}]", name, value); } + @Override public boolean getBoolean(String name, boolean defaultValue) { String value = get(name); if (value == null) { @@ -356,6 +364,7 @@ public class ConfigurationService implements Service, Instrumentable { return super.getBoolean(name, defaultValue); } + @Override public int getInt(String name, int defaultValue) { String value = get(name); if (value == null) { @@ -364,6 +373,7 @@ public class ConfigurationService implements Service, Instrumentable { return super.getInt(name, defaultValue); } + @Override public long getLong(String name, long defaultValue) { String value = get(name); if (value == null) { @@ -372,6 +382,7 @@ public class ConfigurationService implements Service, Instrumentable { return super.getLong(name, defaultValue); } + @Override public float getFloat(String name, float defaultValue) { String value = get(name); if (value == null) { @@ -380,6 +391,7 @@ public class ConfigurationService implements Service, Instrumentable { return super.getFloat(name, defaultValue); } + @Override public Class<?>[] getClasses(String name, Class<?> ... defaultValue) { String value = get(name); if (value == null) { @@ -388,6 +400,7 @@ public class ConfigurationService implements Service, Instrumentable { return super.getClasses(name, defaultValue); } + @Override public Class<?> getClass(String name, Class<?> defaultValue) { String value = get(name); if (value == null) { @@ -413,13 +426,16 @@ public class ConfigurationService implements Service, Instrumentable { * * @param instr instrumentation to use. */ + @Override public void instrument(Instrumentation instr) { instr.addVariable(INSTRUMENTATION_GROUP, "config.dir", new Instrumentation.Variable<String>() { + @Override public String getValue() { return configDir; } }); instr.addVariable(INSTRUMENTATION_GROUP, "config.file", new Instrumentation.Variable<String>() { + @Override public String getValue() { return configFile; } @@ -550,10 +566,14 @@ public class ConfigurationService implements Service, Instrumentable { } public static String getPassword(Configuration conf, String name) { + return getPassword(conf, name, null); + } + + public static String getPassword(Configuration conf, String name, String defaultValue) { if (getPasswordMethod != null) { try { char[] pass = (char[]) getPasswordMethod.invoke(conf, name); - return new String(pass); + return pass == null ? defaultValue : new String(pass); } catch (IllegalAccessException e) { log.error(e); throw new IllegalArgumentException("Could not load password for [" + name + "]", e); @@ -566,8 +586,8 @@ public class ConfigurationService implements Service, Instrumentable { } } - public static String getPassword(String name) { + public static String getPassword(String name, String defaultValue) { Configuration conf = Services.get().getConf(); - return getPassword(conf, name); + return getPassword(conf, name, defaultValue); } } http://git-wip-us.apache.org/repos/asf/oozie/blob/38e33811/core/src/main/java/org/apache/oozie/sla/listener/SLAEmailEventListener.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/oozie/sla/listener/SLAEmailEventListener.java b/core/src/main/java/org/apache/oozie/sla/listener/SLAEmailEventListener.java index 6076056..7631fc9 100644 --- a/core/src/main/java/org/apache/oozie/sla/listener/SLAEmailEventListener.java +++ b/core/src/main/java/org/apache/oozie/sla/listener/SLAEmailEventListener.java @@ -93,6 +93,7 @@ public class SLAEmailEventListener extends SLAEventListener { this.name = name; } + @Override public String toString() { return name; } @@ -107,7 +108,7 @@ public class SLAEmailEventListener extends SLAEventListener { String smtpPort = conf.get(EmailActionExecutor.EMAIL_SMTP_PORT, SMTP_PORT_DEFAULT); Boolean smtpAuth = conf.getBoolean(EmailActionExecutor.EMAIL_SMTP_AUTH, SMTP_AUTH_DEFAULT); String smtpUser = conf.get(EmailActionExecutor.EMAIL_SMTP_USER, ""); - String smtpPassword = ConfigurationService.getPassword(EmailActionExecutor.EMAIL_SMTP_PASS); + String smtpPassword = ConfigurationService.getPassword(EmailActionExecutor.EMAIL_SMTP_PASS, ""); String smtpConnectTimeout = conf.get(SMTP_CONNECTION_TIMEOUT, SMTP_CONNECTION_TIMEOUT_DEFAULT); String smtpTimeout = conf.get(SMTP_TIMEOUT, SMTP_TIMEOUT_DEFAULT); @@ -118,6 +119,7 @@ public class SLAEmailEventListener extends SLAEventListener { blackList = CacheBuilder.newBuilder() .expireAfterWrite(blacklistTimeOut, TimeUnit.SECONDS) .build(new CacheLoader<String, AtomicInteger>() { + @Override public AtomicInteger load(String key) throws Exception { return new AtomicInteger(); } @@ -256,8 +258,9 @@ public class SLAEmailEventListener extends SLAEventListener { } } - if (addrList.size() > 0) + if (addrList.size() > 0) { addrs = (Address[]) addrList.toArray(new InternetAddress[addrList.size()]); + } return addrs; } http://git-wip-us.apache.org/repos/asf/oozie/blob/38e33811/hadooplibs/hadoop-utils-0.23/src/main/java/org/apache/oozie/hadoop/utils/HadoopShims.java ---------------------------------------------------------------------- diff --git a/hadooplibs/hadoop-utils-0.23/src/main/java/org/apache/oozie/hadoop/utils/HadoopShims.java b/hadooplibs/hadoop-utils-0.23/src/main/java/org/apache/oozie/hadoop/utils/HadoopShims.java index 559ce8e..799dffb 100644 --- a/hadooplibs/hadoop-utils-0.23/src/main/java/org/apache/oozie/hadoop/utils/HadoopShims.java +++ b/hadooplibs/hadoop-utils-0.23/src/main/java/org/apache/oozie/hadoop/utils/HadoopShims.java @@ -44,7 +44,7 @@ public class HadoopShims { public void createSymlink(Path target, Path link, boolean createParent) throws IOException { } - public boolean isYARN() { + public static boolean isYARN() { return false; } http://git-wip-us.apache.org/repos/asf/oozie/blob/38e33811/release-log.txt ---------------------------------------------------------------------- diff --git a/release-log.txt b/release-log.txt index c7fc9f0..7cd10d7 100644 --- a/release-log.txt +++ b/release-log.txt @@ -1,5 +1,6 @@ -- Oozie 4.3.0 release (trunk - unreleased) +OOZIE-2365 oozie fail to start when smtp password not set (rohini) OOZIE-2360 Spark Action fails due to missing mesos jar (rkanter) OOZIE-2345 Parallel job submission for forked actions (puru) OOZIE-2358 Coord rerun cleanup should reuse hcat connections (rohini)
