AMBARI-19843. Publish asset has issues when different users logins (Madhan 
Mohan Reddy via gauravn7)

(cherry picked from commit 919500f2fe00e4f2ab923d39ef3ab02f19a78b48)

Change-Id: I07e0757f2c68521cf0606a61b6d60e34c4fff034


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0ef12149
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0ef12149
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0ef12149

Branch: refs/heads/branch-feature-BUG-74026
Commit: 0ef121498f2667c4909d055cf41a0b72ee227b10
Parents: ffaa961
Author: Gaurav Nagar <[email protected]>
Authored: Thu Feb 2 18:15:52 2017 +0530
Committer: Zuul <[email protected]>
Committed: Mon Feb 6 23:24:16 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/oozie/ambari/view/assets/AssetResource.java   | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0ef12149/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java
----------------------------------------------------------------------
diff --git 
a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java
 
b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java
index af86810..ef3b508 100644
--- 
a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java
+++ 
b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/assets/AssetResource.java
@@ -115,7 +115,7 @@ public class AssetResource {
     String workflowXml = oozieUtils.generateWorkflowXml(postBody);
     try {
       Map<String, String> result = new HashMap<>();
-      String tempWfPath = "/tmp" + "/tmpooziewfs/tempwf.xml";
+      String tempWfPath = "/tmp" + "/tmpooziewfs/tempwf_" + 
Math.round(Math.random()*100000) + ".xml";
       hdfsFileUtils.writeToFile(tempWfPath, workflowXml, true);
       queryParams.put("oozieparam.action", getAsList("dryrun"));
       queryParams.put("oozieconfig.rerunOnFailure", getAsList("false"));
@@ -125,6 +125,7 @@ public class AssetResource {
         tempWfPath, queryParams, JobType.WORKFLOW);
       LOGGER.info(String.format("resp from validating asset=[%s]",
         dryRunResp));
+      hdfsFileUtils.deleteFile(tempWfPath);
       if (dryRunResp != null && dryRunResp.trim().startsWith("{")) {
         JsonElement jsonElement = new JsonParser().parse(dryRunResp);
         JsonElement idElem = jsonElement.getAsJsonObject().get("id");

Reply via email to