Forráskód Böngészése

AMBARI-8195. Slider App View is not replacing JAVA_HOME (srimanth)

Srimanth Gunturi 10 éve
szülő
commit
5172bdf2ad

+ 1 - 0
contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewController.java

@@ -43,6 +43,7 @@ public interface SliderAppsViewController {
   public static final String PROPERTY_GANGLIA_CUSTOM_CLUSTERS = "ganglia.additional.clusters";
   public static final String PROPERTY_YARN_RM_WEBAPP_URL = "yarn.rm.webapp.url";
   public static final String PROPERTY_SLIDER_USER = "view.slider.user";
+  public static final String PROPERTY_JAVA_HOME = "java.home";
   public static final String PROPERTY_SLIDER_SECURITY_ENABLED = "slider.security.enabled";
 
   public static final String METRICS_API_NAME = "Metrics API";

+ 11 - 8
contrib/views/slider/src/main/java/org/apache/ambari/view/slider/SliderAppsViewControllerImpl.java

@@ -178,6 +178,7 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
             Map<String, String> ambariServerConfigs = ambariClient.getAmbariServerConfigs();
             if (ambariServerConfigs.containsKey("java.home")) {
               newHadoopConfigs.put("java.home", ambariServerConfigs.get("java.home"));
+              status.getParameters().put(PROPERTY_JAVA_HOME, ambariServerConfigs.get("java.home"));
             }
             // Configs
             if (cluster.getDesiredConfigs().containsKey("core-site")) {
@@ -307,14 +308,16 @@ public class SliderAppsViewControllerImpl implements SliderAppsViewController {
           new ViewStatus.Validation(
               "View parameters specifying Ambari details required"));
     }
-    if (!newHadoopConfigs.equals(viewContext.getInstanceData())) {
-      Set<String> removeKeys = new HashSet<String>(viewContext.getInstanceData().keySet());
-      for (Entry<String, String> e : newHadoopConfigs.entrySet()) {
-        viewContext.putInstanceData(e.getKey(), e.getValue());
-        removeKeys.remove(e.getKey());
-      }
-      for (String key : removeKeys) {
-        viewContext.removeInstanceData(key);
+    synchronized (viewContext) {
+      if (!newHadoopConfigs.equals(viewContext.getInstanceData())) {
+        Set<String> removeKeys = new HashSet<String>(viewContext.getInstanceData().keySet());
+        for (Entry<String, String> e : newHadoopConfigs.entrySet()) {
+          viewContext.putInstanceData(e.getKey(), e.getValue());
+          removeKeys.remove(e.getKey());
+        }
+        for (String key : removeKeys) {
+          viewContext.removeInstanceData(key);
+        }
       }
     }
     return status;

+ 4 - 0
contrib/views/slider/src/main/resources/ui/app/controllers/slider_controller.js

@@ -100,6 +100,10 @@ App.SliderController = Ember.Controller.extend(App.RunPeriodically, {
         && properties['view.slider.user'] != App.get('sliderUser')) {
       App.set('sliderUser', properties['view.slider.user']);
     }
+    if (properties['java.home'] != null
+        && properties['java.home'] != App.get('javaHome')) {
+      App.set('javaHome', properties['java.home']);
+    }
     this.initGangliaProperties();
     this.finishSliderConfiguration(data);
   },

+ 1 - 1
contrib/views/slider/src/main/resources/ui/app/translations.js

@@ -140,7 +140,7 @@ Em.I18n.translations = {
   'wizard.step1.logAggregation.filePatterns.include': 'Include File Patterns',
   'wizard.step1.logAggregation.filePatterns.exclude': 'Exclude File Patterns',
   'wizard.step1.typeDescription': 'Deploys {0} cluster on YARN.',
-  'wizard.step1.nameFormatError': 'App Name should consist only of letters, numbers, \'-\', \'_\' and first character should be a letter.',
+  'wizard.step1.nameFormatError': 'App Name should consist only of lower case letters, numbers, \'-\', and \'_\'. Also, first character should be a lower case letter.',
   'wizard.step1.nameRepeatError': 'App with entered Name already exists.',
   'wizard.step1.validateAppNameError': 'Application with name \'{0}\' already exists',
   'wizard.step1.noAppTypesError': 'No Slider Application packages have been installed on this server. Please contact your Ambari server administrator to install Slider Application packages into /var/lib/ambari-server/resources/apps/ folder and restart Ambari server.',