소스 검색

AMBARI-7377. Slider View: Add support for custom users to login into Ambari and submit application as themselves (srimanth)

Srimanth Gunturi 10 년 전
부모
커밋
c7651de83d
1개의 변경된 파일3개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 4
      contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java

+ 3 - 4
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");