[29/50] ambari git commit: AMBARI-14659. Pig view : explain script contains errors on secure cluster. (Gaurav Nagar via yusaku)
AMBARI-14659. Pig view : explain script contains errors on secure cluster. (Gaurav Nagar via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5289cb66 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5289cb66 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5289cb66 Branch: refs/heads/branch-dev-patch-upgrade Commit: 5289cb66a50f132afb8fb02b0b843e6e62123963 Parents: d0fe0a3 Author: Yusaku Sako Authored: Thu Jan 14 09:56:35 2016 -0800 Committer: Yusaku Sako Committed: Thu Jan 14 09:56:35 2016 -0800 -- .../view/pig/resources/jobs/JobResourceManager.java | 15 +++ .../java/org/apache/ambari/view/pig/BasePigTest.java | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5289cb66/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java -- diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java index 5553255..2bd5745 100644 --- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java +++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java @@ -37,6 +37,8 @@ import org.slf4j.LoggerFactory; import javax.ws.rs.WebApplicationException; import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -166,9 +168,12 @@ public class JobResourceManager extends PersonalCRUDResourceManager { // content can be passed from front-end with substituted arguments if (job.getForcedContent() != null && !job.getForcedContent().isEmpty()) { String forcedContent = job.getForcedContent(); -// variable for sourceFile can be passed from front-ent +URI uri = new URI(context.getProperties().get("webhdfs.url")); +// variable for sourceFile can be passed from front-end +// cannot use webhdfs url as webhcat does not support http authentication +// using url hdfs://host/sourcefilepath forcedContent = forcedContent.replace("${sourceFile}", -context.getProperties().get("webhdfs.url") + newSourceFilePath); +"hdfs://" + uri.getHost() + newSourceFilePath); job.setForcedContent(null); // we should not store content in DB save(job); @@ -183,9 +188,11 @@ public class JobResourceManager extends PersonalCRUDResourceManager { throw new ServiceFormattedException("Can't copy pig script file from " + job.getPigScript() + " to " + newPigScriptPath, e); } catch (IOException e) { - throw new ServiceFormattedException("Can't create/copy pig script file: " + e.toString(), e); + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); } catch (InterruptedException e) { - throw new ServiceFormattedException("Can't create/copy pig script file: " + e.toString(), e); + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); +} catch (URISyntaxException e) { + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); } if (job.getPythonScript() != null && !job.getPythonScript().isEmpty()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/5289cb66/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java -- diff --git a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java index 4ca90a1..2ad2d0f 100644 --- a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java +++ b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java @@ -65,6 +65,7 @@ public abstract class BasePigTest { .getAbsoluteFile(); properties.put("dataworker.storagePath", pigStorageFile.toString()); +properties.put("webhdfs.url", "webhdfs://host:1234"); properties.put("webhcat.hostname", "localhost/templeton/v1"); properties.put("webhcat.port", "50111"); properties.put("webhcat.username", "admin");
ambari git commit: AMBARI-14659. Pig view : explain script contains errors on secure cluster. (Gaurav Nagar via yusaku)
Repository: ambari Updated Branches: refs/heads/branch-2.2 f22ae6e8e -> c56f29d1d AMBARI-14659. Pig view : explain script contains errors on secure cluster. (Gaurav Nagar via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c56f29d1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c56f29d1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c56f29d1 Branch: refs/heads/branch-2.2 Commit: c56f29d1d4ec2b97df373e06a7ebb0adf1aa39f9 Parents: f22ae6e Author: Yusaku Sako Authored: Thu Jan 14 09:56:35 2016 -0800 Committer: Yusaku Sako Committed: Thu Jan 14 09:57:22 2016 -0800 -- .../view/pig/resources/jobs/JobResourceManager.java | 15 +++ .../java/org/apache/ambari/view/pig/BasePigTest.java | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/c56f29d1/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java -- diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java index 5553255..2bd5745 100644 --- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java +++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java @@ -37,6 +37,8 @@ import org.slf4j.LoggerFactory; import javax.ws.rs.WebApplicationException; import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -166,9 +168,12 @@ public class JobResourceManager extends PersonalCRUDResourceManager { // content can be passed from front-end with substituted arguments if (job.getForcedContent() != null && !job.getForcedContent().isEmpty()) { String forcedContent = job.getForcedContent(); -// variable for sourceFile can be passed from front-ent +URI uri = new URI(context.getProperties().get("webhdfs.url")); +// variable for sourceFile can be passed from front-end +// cannot use webhdfs url as webhcat does not support http authentication +// using url hdfs://host/sourcefilepath forcedContent = forcedContent.replace("${sourceFile}", -context.getProperties().get("webhdfs.url") + newSourceFilePath); +"hdfs://" + uri.getHost() + newSourceFilePath); job.setForcedContent(null); // we should not store content in DB save(job); @@ -183,9 +188,11 @@ public class JobResourceManager extends PersonalCRUDResourceManager { throw new ServiceFormattedException("Can't copy pig script file from " + job.getPigScript() + " to " + newPigScriptPath, e); } catch (IOException e) { - throw new ServiceFormattedException("Can't create/copy pig script file: " + e.toString(), e); + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); } catch (InterruptedException e) { - throw new ServiceFormattedException("Can't create/copy pig script file: " + e.toString(), e); + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); +} catch (URISyntaxException e) { + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); } if (job.getPythonScript() != null && !job.getPythonScript().isEmpty()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/c56f29d1/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java -- diff --git a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java index 4ca90a1..2ad2d0f 100644 --- a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java +++ b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java @@ -65,6 +65,7 @@ public abstract class BasePigTest { .getAbsoluteFile(); properties.put("dataworker.storagePath", pigStorageFile.toString()); +properties.put("webhdfs.url", "webhdfs://host:1234"); properties.put("webhcat.hostname", "localhost/templeton/v1"); properties.put("webhcat.port", "50111"); properties.put("webhcat.username", "admin");
ambari git commit: AMBARI-14659. Pig view : explain script contains errors on secure cluster. (Gaurav Nagar via yusaku)
Repository: ambari Updated Branches: refs/heads/trunk d0fe0a329 -> 5289cb66a AMBARI-14659. Pig view : explain script contains errors on secure cluster. (Gaurav Nagar via yusaku) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5289cb66 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5289cb66 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5289cb66 Branch: refs/heads/trunk Commit: 5289cb66a50f132afb8fb02b0b843e6e62123963 Parents: d0fe0a3 Author: Yusaku Sako Authored: Thu Jan 14 09:56:35 2016 -0800 Committer: Yusaku Sako Committed: Thu Jan 14 09:56:35 2016 -0800 -- .../view/pig/resources/jobs/JobResourceManager.java | 15 +++ .../java/org/apache/ambari/view/pig/BasePigTest.java | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/ambari/blob/5289cb66/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java -- diff --git a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java index 5553255..2bd5745 100644 --- a/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java +++ b/contrib/views/pig/src/main/java/org/apache/ambari/view/pig/resources/jobs/JobResourceManager.java @@ -37,6 +37,8 @@ import org.slf4j.LoggerFactory; import javax.ws.rs.WebApplicationException; import java.io.File; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; @@ -166,9 +168,12 @@ public class JobResourceManager extends PersonalCRUDResourceManager { // content can be passed from front-end with substituted arguments if (job.getForcedContent() != null && !job.getForcedContent().isEmpty()) { String forcedContent = job.getForcedContent(); -// variable for sourceFile can be passed from front-ent +URI uri = new URI(context.getProperties().get("webhdfs.url")); +// variable for sourceFile can be passed from front-end +// cannot use webhdfs url as webhcat does not support http authentication +// using url hdfs://host/sourcefilepath forcedContent = forcedContent.replace("${sourceFile}", -context.getProperties().get("webhdfs.url") + newSourceFilePath); +"hdfs://" + uri.getHost() + newSourceFilePath); job.setForcedContent(null); // we should not store content in DB save(job); @@ -183,9 +188,11 @@ public class JobResourceManager extends PersonalCRUDResourceManager { throw new ServiceFormattedException("Can't copy pig script file from " + job.getPigScript() + " to " + newPigScriptPath, e); } catch (IOException e) { - throw new ServiceFormattedException("Can't create/copy pig script file: " + e.toString(), e); + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); } catch (InterruptedException e) { - throw new ServiceFormattedException("Can't create/copy pig script file: " + e.toString(), e); + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); +} catch (URISyntaxException e) { + throw new ServiceFormattedException("Can't create/copy pig script file: " + e.getMessage(), e); } if (job.getPythonScript() != null && !job.getPythonScript().isEmpty()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/5289cb66/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java -- diff --git a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java index 4ca90a1..2ad2d0f 100644 --- a/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java +++ b/contrib/views/pig/src/test/java/org/apache/ambari/view/pig/BasePigTest.java @@ -65,6 +65,7 @@ public abstract class BasePigTest { .getAbsoluteFile(); properties.put("dataworker.storagePath", pigStorageFile.toString()); +properties.put("webhdfs.url", "webhdfs://host:1234"); properties.put("webhcat.hostname", "localhost/templeton/v1"); properties.put("webhcat.port", "50111"); properties.put("webhcat.username", "admin");