You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by an...@apache.org on 2019/01/10 16:01:38 UTC

[oozie] branch master updated: OOZIE-3415 [core] libpath cannot be used together with coord.application.path and bundle.application.path (asalamon74 via andras.piros)

This is an automated email from the ASF dual-hosted git repository.

andras pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/oozie.git


The following commit(s) were added to refs/heads/master by this push:
     new 8e8ebbb  OOZIE-3415 [core] libpath cannot be used together with coord.application.path and bundle.application.path (asalamon74 via andras.piros)
8e8ebbb is described below

commit 8e8ebbbc7f12c144a3f26a838474d1ce3b801b1b
Author: Andras Piros <an...@cloudera.com>
AuthorDate: Thu Jan 10 17:01:08 2019 +0100

    OOZIE-3415 [core] libpath cannot be used together with coord.application.path and bundle.application.path (asalamon74 via andras.piros)
---
 .../org/apache/oozie/servlet/BaseJobsServlet.java    |  4 +---
 .../java/org/apache/oozie/servlet/V1JobsServlet.java | 20 ++++++++++----------
 .../org/apache/oozie/servlet/TestV1JobsServlet.java  | 14 ++------------
 release-log.txt                                      |  1 +
 4 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/core/src/main/java/org/apache/oozie/servlet/BaseJobsServlet.java b/core/src/main/java/org/apache/oozie/servlet/BaseJobsServlet.java
index 8df1443..f351ae7 100644
--- a/core/src/main/java/org/apache/oozie/servlet/BaseJobsServlet.java
+++ b/core/src/main/java/org/apache/oozie/servlet/BaseJobsServlet.java
@@ -127,14 +127,12 @@ public abstract class BaseJobsServlet extends JsonRestServlet {
         }
 
         if (Strings.isNullOrEmpty(configuration.get(OozieClient.APP_PATH))
-                && Strings.isNullOrEmpty(configuration.get(OozieClient.LIBPATH))
                 && Strings.isNullOrEmpty(configuration.get(OozieClient.COORDINATOR_APP_PATH))
                 && Strings.isNullOrEmpty(configuration.get(OozieClient.BUNDLE_APP_PATH))) {
             final String generatedJobApplicationPath = ConfigurationService.get("oozie.fluent-job-api.generated.path")
                     + File.separator + "gen_app_" + new Date().getTime();
-            LOG.debug("Parameters [{0}], [{1}], [{2}], and [{3}] were all missing, setting to generated path [{4}]",
+            LOG.debug("Parameters [{0}], [{1}], and [{2}] were all missing, setting to generated path [{3}]",
                     OozieClient.APP_PATH,
-                    OozieClient.LIBPATH,
                     OozieClient.COORDINATOR_APP_PATH,
                     OozieClient.BUNDLE_APP_PATH,
                     generatedJobApplicationPath);
diff --git a/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java b/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java
index 8ffd441..3ca0ea8 100644
--- a/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java
+++ b/core/src/main/java/org/apache/oozie/servlet/V1JobsServlet.java
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.google.common.base.Strings;
 import com.google.common.collect.Lists;
+import org.apache.commons.lang.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
@@ -148,9 +149,6 @@ public class V1JobsServlet extends BaseJobsServlet {
         if (!findAppPathsWithFileNames(appPath, "workflow.xml").isEmpty()) {
             appPathsWithFileNames = findAppPathsWithFileNames(appPath, "workflow.xml");
         }
-        else if (!findAppPathsWithFileNames(conf.get(OozieClient.LIBPATH), "workflow.xml").isEmpty()) {
-            appPathsWithFileNames = findAppPathsWithFileNames(conf.get(OozieClient.LIBPATH), "workflow.xml");
-        }
         else if (!findAppPathsWithFileNames(conf.get(OozieClient.COORDINATOR_APP_PATH), "coordinator.xml").isEmpty()) {
             appPathsWithFileNames = findAppPathsWithFileNames(conf.get(OozieClient.COORDINATOR_APP_PATH), "coordinator.xml");
         }
@@ -166,14 +164,16 @@ public class V1JobsServlet extends BaseJobsServlet {
             }
         }
 
+        final String sourceContent = conf.get(OozieClient.CONFIG_KEY_GENERATED_XML);
+        if (sourceContent == null) {
+            final String xmlFiles = StringUtils.join(appPathsWithFileNames, ",");
+            final String errorMessage = String.format("XML file [%s] does not exist and " +
+                            "app definition cannot be created because of missing config value [%s]",
+                    xmlFiles,  OozieClient.CONFIG_KEY_GENERATED_XML);
+            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0307, errorMessage);
+        }
+
         for (final String appPathWithFileName : appPathsWithFileNames) {
-            final String sourceContent = conf.get(OozieClient.CONFIG_KEY_GENERATED_XML);
-            if (sourceContent == null) {
-                final String errorMessage = String.format("App directory [%s] does not exist and " +
-                        "app definition cannot be created because of missing config value [%s]",
-                        appPath,  OozieClient.CONFIG_KEY_GENERATED_XML);
-                throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0307, errorMessage);
-            }
             if (tryCreateOnDFS(userName, appPathWithFileName, sourceContent)) {
                 return;
             }
diff --git a/core/src/test/java/org/apache/oozie/servlet/TestV1JobsServlet.java b/core/src/test/java/org/apache/oozie/servlet/TestV1JobsServlet.java
index 589d859..dae660e 100644
--- a/core/src/test/java/org/apache/oozie/servlet/TestV1JobsServlet.java
+++ b/core/src/test/java/org/apache/oozie/servlet/TestV1JobsServlet.java
@@ -136,12 +136,7 @@ public class TestV1JobsServlet extends DagServletTestCase {
                 conn.setRequestProperty("content-type", RestConstants.XML_CONTENT_TYPE);
                 conn.setDoOutput(true);
                 jobConf.writeXml(conn.getOutputStream());
-                assertEquals(HttpServletResponse.SC_CREATED, conn.getResponseCode());
-                obj = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream()));
-                assertEquals(MockDagEngineService.JOB_ID + wfCount + MockDagEngineService.JOB_ID_END,
-                             obj.get(JsonTags.JOB_ID));
-                assertFalse(MockDagEngineService.started.get(wfCount));
-                wfCount++;
+                assertEquals(HttpServletResponse.SC_BAD_REQUEST, conn.getResponseCode());
 
                 Path libPath2 = new Path(getFsTestCaseDir(), "libpath2");
                 fs.mkdirs(libPath2);
@@ -156,12 +151,7 @@ public class TestV1JobsServlet extends DagServletTestCase {
                 conn.setRequestProperty("content-type", RestConstants.XML_CONTENT_TYPE);
                 conn.setDoOutput(true);
                 jobConf.writeXml(conn.getOutputStream());
-                assertEquals(HttpServletResponse.SC_CREATED, conn.getResponseCode());
-                obj = (JSONObject) JSONValue.parse(new InputStreamReader(conn.getInputStream()));
-                assertEquals(MockDagEngineService.JOB_ID + wfCount + MockDagEngineService.JOB_ID_END,
-                             obj.get(JsonTags.JOB_ID));
-                assertFalse(MockDagEngineService.started.get(wfCount));
-                wfCount++;
+                assertEquals(HttpServletResponse.SC_BAD_REQUEST, conn.getResponseCode());
 
                 return null;
             }
diff --git a/release-log.txt b/release-log.txt
index 2b6664f..9221995 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.2.0 release (trunk - unreleased)
 
+OOZIE-3415 [core] libpath cannot be used together with coord.application.path and bundle.application.path (asalamon74 via andras.piros)
 OOZIE-3407 [tests] Cleanup TestPurgeXCommand (asalamon74 via andras.piros)
 OOZIE-3067 [core] Remove duplicate logic from ZKJobsConcurrencyService (dionusos via andras.piros)
 OOZIE-3186 [core] Oozie is unable to use configuration linked using jceks://file/ (dionusos via andras.piros)