Author: tucu
Date: Fri Apr 27 23:09:08 2012
New Revision: 1331628
URL: http://svn.apache.org/viewvc?rev=1331628&view=rev
Log:
OOZIE-820 Shell action to support env-var value with = sign (mona via tucu)
Modified:
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellMain.java
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
incubator/oozie/trunk/release-log.txt
Modified:
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellMain.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellMain.java?rev=1331628&r1=1331627&r2=1331628&view=diff
==============================================================================
---
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellMain.java
(original)
+++
incubator/oozie/trunk/core/src/main/java/org/apache/oozie/action/hadoop/ShellMain.java
Fri Apr 27 23:09:08 2012
@@ -115,7 +115,7 @@ public class ShellMain extends LauncherM
// Adding user-specified environments
String[] envs = MapReduceMain.getStrings(actionConf,
CONF_OOZIE_SHELL_ENVS);
for (String env : envs) {
- String[] varValue = env.split("="); // Error case is handled in
+ String[] varValue = env.split("=",2); // Error case is handled in
// ShellActionExecutor
envp.put(varValue[0], varValue[1]);
}
Modified:
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
URL:
http://svn.apache.org/viewvc/incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java?rev=1331628&r1=1331627&r2=1331628&view=diff
==============================================================================
---
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
(original)
+++
incubator/oozie/trunk/core/src/test/java/org/apache/oozie/action/hadoop/TestShellActionExecutor.java
Fri Apr 27 23:09:08 2012
@@ -180,6 +180,50 @@ public class TestShellActionExecutor ext
}
/**
+ * Test that env variable can contain '=' symbol within value
+ *
+ * @throws Exception
+ */
+ public void testEnvVar() throws Exception {
+
+ String shellScript = "ls -ltr\necho var1=$var1\necho var2=$var2";
+ FileSystem fs = getFileSystem();
+ // Create the script file with canned shell command
+ Path script = new Path(getAppPath(), "script.sh");
+ Writer w = new OutputStreamWriter(fs.create(script));
+ w.write(shellScript);
+ w.close();
+
+ String envValueHavingEqualSign = "a=b;c=d";
+ // Create sample shell action xml
+ String actionXml = "<shell>" + "<job-tracker>" + getJobTrackerUri() +
"</job-tracker>" + "<name-node>"
+ + getNameNodeUri() + "</name-node>" + "<exec>sh</exec>" +
"<argument>-c</argument>"
+ + "<argument>script.sh</argument>" + "<argument>A</argument>"
+ "<argument>B</argument>"
+ + "<env-var>var1=val1</env-var>" + "<env-var>var2=" +
envValueHavingEqualSign + "</env-var>" + "<file>" + script.toString()
+ + "#" + script.getName() + "</file>" + "<capture-output />" +
"</shell>";
+
+ Context context = createContext(actionXml);
+ // Submit the action
+ final RunningJob launcherJob = submitAction(context);
+ waitFor(30 * 1000, new Predicate() { // Wait for the external job to
+ // finish
+ public boolean evaluate() throws Exception {
+ return launcherJob.isComplete();
+ }
+ });
+
+ ShellActionExecutor ae = new ShellActionExecutor();
+ WorkflowAction action = context.getAction();
+ ae.check(context, action);
+ ae.end(context, action);
+
+ // Checking action data from shell script output
+ assertEquals(envValueHavingEqualSign,
PropertiesUtils.stringToProperties(action.getData())
+ .getProperty("var2"));
+
+ }
+
+ /**
* Submit the WF with a Shell action and very of the job succeeds
*
* @param actionXml
Modified: incubator/oozie/trunk/release-log.txt
URL:
http://svn.apache.org/viewvc/incubator/oozie/trunk/release-log.txt?rev=1331628&r1=1331627&r2=1331628&view=diff
==============================================================================
--- incubator/oozie/trunk/release-log.txt (original)
+++ incubator/oozie/trunk/release-log.txt Fri Apr 27 23:09:08 2012
@@ -1,17 +1,18 @@
-- Oozie 3.2.0 release
+OOZIE-820 OOZIE-820 Shell action to support env-var value with = sign (mona
via tucu)
OOZIE-813 Sub-workflow child job does not get group name even if parent
carries.(Mona via Mohammad)
-OOZIE-791: coord job status not updated to done_with_error after kill(Virag
via Mohammad)
+OOZIE-791 coord job status not updated to done_with_error after kill(Virag via
Mohammad)
OOZIE-804 TestDecisionActionExecutor failing due to uninitialized conf.(Virag
via Mohammad)
OOZIE-805 TestCoordSubmitX failing(Virag via Mohamamd).
OOZIE-803 UP Remove HadoopAccessorService createFileSystem() method that takes
config only (tucu)
OOZIE-802 Add minicluster config as hadoop-site.xml for testcases (tucu)
OOZIE-796 Making the maximum number of job retrials configurable (Mohamed via
Mohammad)
-OOZIE-741: the size of the workflow definition file (Mohamed via Mohammad)
+OOZIE-741 the size of the workflow definition file (Mohamed via Mohammad)
OOZIE-797 Action retry not reading default error code.(Mona via Mohammad)
-OOZIE-780: XConfiguration parser can't parse XML file with <include> element
(Virag via Mohammad)
-OOZIE-794: oozie job -info -filter should error out on bundle job and workflow
job (virag via Mohammad)
-OOZIE-799: Testcases failing due to missing action-conf dir. (Virag via
Mohammad)
+OOZIE-780 XConfiguration parser can't parse XML file with <include> element
(Virag via Mohammad)
+OOZIE-794 oozie job -info -filter should error out on bundle job and workflow
job (virag via Mohammad)
+OOZIE-799 Testcases failing due to missing action-conf dir. (Virag via
Mohammad)
OOZIE-798 it would be nice to keep action specific configs in action-conf
instead of hadoop-conf (rvs via tucu)
OOZIE-790 default concurrency value is inconsistent between doc and
implementation.(Mohammad)
OOZIE-793 remove HiveMain check for HADOOP_HOME (tucu)