You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2014/07/08 21:09:22 UTC

git commit: AMBARI-6413. Some services were broken after adding service. (atkach via yusaku)

Repository: ambari
Updated Branches:
  refs/heads/trunk 3efb5fc48 -> cd757e000


AMBARI-6413. Some services were broken after adding service. (atkach via yusaku)


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

Branch: refs/heads/trunk
Commit: cd757e0009ddd2408b742988d74ac9bbfe7a0d8d
Parents: 3efb5fc
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Tue Jul 8 12:09:27 2014 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Tue Jul 8 12:09:27 2014 -0700

----------------------------------------------------------------------
 .../app/controllers/wizard/step7_controller.js  |  1 +
 ambari-web/app/models/service_config.js         | 47 +++++++++++---------
 ambari-web/app/utils/config.js                  |  2 +-
 3 files changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/cd757e00/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 7c17c8c..d59c1fd 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -810,6 +810,7 @@ App.WizardStep7Controller = Em.Controller.extend({
         if (_config.defaultValue != configsMap[_config.name])
           _config.value = configsMap[_config.name];
         _config.defaultValue = configsMap[_config.name];
+        _config.hasInitialValue = true;
         App.config.handleSpecialProperties(_config);
         delete configsMap[_config.name];
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/cd757e00/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index d405fe6..330514c 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -170,6 +170,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
   editDone: false, //Text field: on focusOut: true, on focusIn: false
   serviceValidator: null,
   isNotSaved: false, // user property was added but not saved
+  hasInitialValue: false, //if true then property value is defined and saved to server
   /**
    * Usage example see on <code>App.ServiceConfigRadioButtons.handleDBConnectionProperty()</code>
    *
@@ -248,37 +249,39 @@ App.ServiceConfigProperty = Ember.Object.extend({
     var hostsInfo = localDB.hosts; // which we are setting in installerController in step3.
     var slaveComponentHostsInDB = localDB.slaveComponentHosts;
     var isOnlyFirstOneNeeded = true;
+    var hostWithPort = "([\\w|\\.]*)(?=:)";
+    var hostWithPrefix = ":\/\/" + hostWithPort;
     switch (this.get('name')) {
       case 'namenode_host':
         this.set('value', masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName'));
         break;
       case 'dfs.http.address':
         var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",nnHost);
+        this.setDefaultValue(hostWithPort,nnHost);
         break;
       case 'dfs.namenode.http-address':
         var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",nnHost);
+        this.setDefaultValue(hostWithPort,nnHost);
         break;
       case 'dfs.https.address':
         var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",nnHost);
+        this.setDefaultValue(hostWithPort,nnHost);
         break;
       case 'dfs.namenode.https-address':
         var nnHost =  masterComponentHostsInDB.findProperty('component', 'NAMENODE').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",nnHost);
+        this.setDefaultValue(hostWithPort,nnHost);
         break;
       case 'fs.default.name':
         var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
-        this.setDefaultValue(":\/\/(\\w*)(?=:)",'://' + nnHost);
+        this.setDefaultValue(hostWithPrefix,'://' + nnHost);
         break;
       case 'fs.defaultFS':
         var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
-        this.setDefaultValue(":\/\/(\\w*)(?=:)",'://' + nnHost);
+        this.setDefaultValue(hostWithPrefix,'://' + nnHost);
         break;
       case 'hbase.rootdir':
         var nnHost = masterComponentHostsInDB.filterProperty('component', 'NAMENODE').mapProperty('hostName');
-        this.setDefaultValue(":\/\/(\\w*)(?=:)",'://' + nnHost);
+        this.setDefaultValue(hostWithPrefix,'://' + nnHost);
         break;
       case 'snamenode_host':
         // Secondary NameNode does not exist when NameNode HA is enabled
@@ -290,13 +293,13 @@ App.ServiceConfigProperty = Ember.Object.extend({
       case 'dfs.secondary.http.address':
         var snnHost = masterComponentHostsInDB.findProperty('component', 'SECONDARY_NAMENODE');
         if (snnHost) {
-          this.setDefaultValue("(\\w*)(?=:)",snnHost.hostName);
+          this.setDefaultValue(hostWithPort,snnHost.hostName);
         }
         break;
       case 'dfs.namenode.secondary.http-address':
         var snnHost = masterComponentHostsInDB.findProperty('component', 'SECONDARY_NAMENODE');
         if (snnHost) {
-          this.setDefaultValue("(\\w*)(?=:)",snnHost.hostName);
+          this.setDefaultValue(hostWithPort,snnHost.hostName);
         }
         break;
       case 'datanode_hosts':
@@ -307,15 +310,15 @@ App.ServiceConfigProperty = Ember.Object.extend({
         break;
       case 'yarn.log.server.url':
         var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
-        this.setDefaultValue(":\/\/(\\w*)(?=:)",'://' + hsHost);
+        this.setDefaultValue(hostWithPrefix,'://' + hsHost);
         break;
       case 'mapreduce.jobhistory.webapp.address':
         var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
-        this.setDefaultValue("(\\w*)(?=:)",hsHost);
+        this.setDefaultValue(hostWithPort,hsHost);
         break;
       case 'mapreduce.jobhistory.address':
         var hsHost = masterComponentHostsInDB.filterProperty('component', 'HISTORYSERVER').mapProperty('hostName');
-        this.setDefaultValue("(\\w*)(?=:)",hsHost);
+        this.setDefaultValue(hostWithPort,hsHost);
         break;
       case 'rm_host':
         this.set('value', masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName);
@@ -334,23 +337,23 @@ App.ServiceConfigProperty = Ember.Object.extend({
         break;
       case 'yarn.resourcemanager.resource-tracker.address':
         var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",rmHost);
+        this.setDefaultValue(hostWithPort,rmHost);
         break;
       case 'yarn.resourcemanager.webapp.address':
         var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",rmHost);
+        this.setDefaultValue(hostWithPort,rmHost);
         break;
       case 'yarn.resourcemanager.scheduler.address':
         var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",rmHost);
+        this.setDefaultValue(hostWithPort,rmHost);
         break;
       case 'yarn.resourcemanager.address':
         var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",rmHost);
+        this.setDefaultValue(hostWithPort,rmHost);
         break;
       case 'yarn.resourcemanager.admin.address':
         var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",rmHost);
+        this.setDefaultValue(hostWithPort,rmHost);
         break;
       case 'yarn.timeline-service.webapp.address':
         var atsHost =  masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER');
@@ -378,15 +381,15 @@ App.ServiceConfigProperty = Ember.Object.extend({
         break;
       case 'mapred.job.tracker':
         var jtHost = masterComponentHostsInDB.findProperty('component', 'JOBTRACKER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",jtHost);
+        this.setDefaultValue(hostWithPort,jtHost);
         break;
       case 'mapred.job.tracker.http.address':
         var jtHost = masterComponentHostsInDB.findProperty('component', 'JOBTRACKER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",jtHost);
+        this.setDefaultValue(hostWithPort,jtHost);
         break;
       case 'mapreduce.history.server.http.address':
         var jtHost = masterComponentHostsInDB.findProperty('component', 'HISTORYSERVER').hostName;
-        this.setDefaultValue("(\\w*)(?=:)",jtHost);
+        this.setDefaultValue(hostWithPort,jtHost);
         break;
       case 'tasktracker_hosts':
         this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'TASKTRACKER').hosts.mapProperty('hostName'));
@@ -402,7 +405,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
         break;
       case 'hive.metastore.uris':
         var hiveHost = masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName;
-        this.setDefaultValue(":\/\/(\\w*)(?=:)",'://' + hiveHost);
+        this.setDefaultValue(hostWithPrefix,'://' + hiveHost);
         break;
       case 'hive_ambari_host':
         this.set('value', masterComponentHostsInDB.findProperty('component', 'HIVE_SERVER').hostName);
@@ -412,7 +415,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
         break;
       case 'oozie.base.url':
         var oozieHost = masterComponentHostsInDB.findProperty('component', 'OOZIE_SERVER').hostName;
-        this.setDefaultValue(":\/\/(\\w*)(?=:)",'://' + oozieHost);
+        this.setDefaultValue(hostWithPrefix,'://' + oozieHost);
         break;
       case 'webhcatserver_host':
         this.set('value', masterComponentHostsInDB.findProperty('component', 'WEBHCAT_SERVER').hostName);

http://git-wip-us.apache.org/repos/asf/ambari/blob/cd757e00/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 4073cc8..87dd0da 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -616,7 +616,7 @@ App.config = Em.Object.create({
         _config.isOverridable = (_config.isOverridable === undefined) ? true : _config.isOverridable;
         var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
         this.updateHostOverrides(serviceConfigProperty, _config);
-        if (!storedConfigs) {
+        if (!storedConfigs && !serviceConfigProperty.get('hasInitialValue')) {
           serviceConfigProperty.initialValue(localDB);
         }
         this.tweakDynamicDefaults(localDB, serviceConfigProperty, _config);