AMBARI-7377. Slider View: Add support for custom users to login into Ambari and submit application as themselves (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c7651de8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c7651de8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c7651de8 Branch: refs/heads/branch-alerts-dev Commit: c7651de83d16e2d9de16ca99399aaa9ad3c595cd Parents: 7a087b1 Author: Srimanth Gunturi <sgunt...@hortonworks.com> Authored: Wed Sep 17 17:08:47 2014 -0700 Committer: Srimanth Gunturi <sgunt...@hortonworks.com> Committed: Wed Sep 17 17:37:39 2014 -0700 ---------------------------------------------------------------------- .../ambari/view/slider/SliderAppsViewControllerImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/c7651de8/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java index 3626cbe..027f824 100644 --- a/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java +++ b/contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java @@ -133,7 +133,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController { ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { - T value = UserGroupInformation.getBestUGI(null, "yarn").doAs( + T value = UserGroupInformation.getBestUGI(null, viewContext.getUsername()).doAs( new PrivilegedExceptionAction<T>() { @Override public T run() throws Exception { @@ -274,7 +274,6 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController { app.setConfigs(configs); } else if ("components".equals(property.toLowerCase())) { try { - System.setProperty(SliderKeys.HADOOP_USER_NAME, "yarn"); ClusterDescription description = sliderClient .getClusterDescription(yarnApp.getName()); if (description != null && description.status != null @@ -368,7 +367,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController { SliderClient client = new SliderClient() { @Override public String getUsername() throws IOException { - return "yarn"; + return viewContext.getUsername(); } @Override @@ -377,7 +376,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController { // Override the default FS client to the calling user try { FileSystem fs = FileSystem.get(FileSystem.getDefaultUri(getConfig()), - getConfig(), "yarn"); + getConfig(), viewContext.getUsername()); SliderFileSystem fileSystem = new SliderFileSystem(fs, getConfig()); Field fsField = SliderClient.class .getDeclaredField("sliderFileSystem");