incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject git commit: AMBARI-3594: Service reconfiguration fails for multiple services. (jaimin)
Date Sat, 26 Oct 2013 02:57:16 GMT
Updated Branches:
  refs/heads/trunk a1fedaf88 -> 0b5dfa542


AMBARI-3594: Service reconfiguration fails for multiple services. (jaimin)


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

Branch: refs/heads/trunk
Commit: 0b5dfa542e27c6a530e79e9712e125a7bfb0c5b0
Parents: a1fedaf
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Fri Oct 25 19:56:54 2013 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Fri Oct 25 19:56:54 2013 -0700

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 43 +++++++++--------
 .../main/service/reassign_controller.js         | 50 ++++++++++----------
 ambari-web/app/utils/config.js                  |  2 +-
 ambari-web/app/views/wizard/controls_view.js    | 43 ++++++++++++-----
 4 files changed, 82 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5dfa54/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index b3ac88f..88e1829 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -548,17 +548,17 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         var hdfsConfigs = self.get('stepConfigs').findProperty('serviceName', 'HDFS').get('configs');
         if (App.get('isHadoop2Stack')) {
           if (
-            hdfsConfigs.findProperty('name', 'dfs_namenode_name_dir').get('isNotDefaultValue')
||
-              hdfsConfigs.findProperty('name', 'dfs_namenode_checkpoint_dir').get('isNotDefaultValue')
||
-              hdfsConfigs.findProperty('name', 'dfs_datanode_data_dir').get('isNotDefaultValue')
+            hdfsConfigs.findProperty('name', 'dfs.namenode.name.dir').get('isNotDefaultValue')
||
+              hdfsConfigs.findProperty('name', 'dfs.namenode.checkpoint.dir').get('isNotDefaultValue')
||
+              hdfsConfigs.findProperty('name', 'dfs.datanode.data.dir').get('isNotDefaultValue')
             ) {
             dirChanged = true;
           }
         } else {
           if (
-            hdfsConfigs.findProperty('name', 'dfs_name_dir').get('isNotDefaultValue') ||
-              hdfsConfigs.findProperty('name', 'fs_checkpoint_dir').get('isNotDefaultValue')
||
-              hdfsConfigs.findProperty('name', 'dfs_data_dir').get('isNotDefaultValue')
+            hdfsConfigs.findProperty('name', 'dfs.name.dir').get('isNotDefaultValue') ||
+              hdfsConfigs.findProperty('name', 'fs.checkpoint.dir').get('isNotDefaultValue')
||
+              hdfsConfigs.findProperty('name', 'dfs.data.dir').get('isNotDefaultValue')
             ) {
             dirChanged = true;
           }
@@ -566,8 +566,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       } else if (serviceName === 'MAPREDUCE') {
         var mapredConfigs = self.get('stepConfigs').findProperty('serviceName', 'MAPREDUCE').get('configs');
         if (
-          mapredConfigs.findProperty('name', 'mapred_local_dir').get('isNotDefaultValue')
||
-            mapredConfigs.findProperty('name', 'mapred_system_dir').get('isNotDefaultValue')
+          mapredConfigs.findProperty('name', 'mapred.local.dir').get('isNotDefaultValue')
||
+            mapredConfigs.findProperty('name', 'mapred.system.dir').get('isNotDefaultValue')
           ) {
           dirChanged = true;
         }
@@ -1008,13 +1008,15 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     var serviceConfigTags = this.get('serviceConfigTags');
     this.setNewTagNames(serviceConfigTags);
     var siteNameToServerDataMap = {};
+    var configController = App.router.get('configurationController');
 
     serviceConfigTags.forEach(function (_serviceTags) {
       if (_serviceTags.siteName === 'global') {
         console.log("TRACE: Inside global");
         var serverGlobalConfigs = this.createGlobalSiteObj(_serviceTags.newTagName);
         siteNameToServerDataMap['global'] = serverGlobalConfigs;
-        if (this.isConfigChanged(App.config.loadedConfigurationsCache['global_' + this.loadedClusterSiteToTagMap['global']],
serverGlobalConfigs.properties)) {
+        var loadedProperties = configController.getConfigsByTags([{siteName: 'global', tagName:
this.loadedClusterSiteToTagMap['global']}]);
+        if (this.isConfigChanged(loadedProperties, serverGlobalConfigs.properties)) {
           result = result && this.doPUTClusterConfigurationSite(serverGlobalConfigs);
         }
       } else if (_serviceTags.siteName === 'core-site') {
@@ -1022,14 +1024,16 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
         if (this.get('content.serviceName') === 'HDFS' || this.get('content.serviceName')
=== 'HCFS') {
           var coreSiteConfigs = this.createCoreSiteObj(_serviceTags.newTagName);
           siteNameToServerDataMap['core-site'] = coreSiteConfigs;
-          if (this.isConfigChanged(App.config.loadedConfigurationsCache['core-site_' + this.loadedClusterSiteToTagMap['core-site']],
coreSiteConfigs.properties)) {
+          var loadedProperties = configController.getConfigsByTags([{siteName: 'core-site',
tagName: this.loadedClusterSiteToTagMap['core-site']}]);
+          if (this.isConfigChanged(loadedProperties, coreSiteConfigs.properties)) {
             result = result && this.doPUTClusterConfigurationSite(coreSiteConfigs);
           }
         }
       } else {
         var serverConfigs = this.createSiteObj(_serviceTags.siteName, _serviceTags.newTagName);
         siteNameToServerDataMap[_serviceTags.siteName] = serverConfigs;
-        if (this.isConfigChanged(App.config.loadedConfigurationsCache[_serviceTags.siteName
+ '_' + this.loadedClusterSiteToTagMap[_serviceTags.siteName]], serverConfigs.properties))
{
+        var loadedProperties = configController.getConfigsByTags([{siteName: _serviceTags.siteName,
tagName: this.loadedClusterSiteToTagMap[_serviceTags.siteName]}]);
+        if (this.isConfigChanged(loadedProperties, serverConfigs.properties)) {
           result = result && this.doPUTClusterConfigurationSite(serverConfigs);
         }
       }
@@ -1328,20 +1332,20 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     switch (oozieDb) {
       case 'New Derby Database':
         defaultJdbcUrl = "jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true";
-        jdbcDriver.value = "org.apache.derby.jdbc.EmbeddedDriver";
+        jdbcDriver.set('value','org.apache.derby.jdbc.EmbeddedDriver');
         break;
       case 'Existing MySQL Database':
         defaultJdbcUrl = "jdbc:mysql://" + oozieHost + "/" + oozieDbName;
-        jdbcDriver.value = "com.mysql.jdbc.Driver";
+        jdbcDriver.set('value','com.mysql.jdbc.Driver');
         break;
       case 'Existing Oracle Database':
         defaultJdbcUrl = "jdbc:oracle:thin:@//" + oozieHost + ":1521/" + oozieDbName;
-        jdbcDriver.value = "oracle.jdbc.driver.OracleDriver";
+        jdbcDriver.set('value','oracle.jdbc.driver.OracleDriver');
         break;
     }
     // in case the user upgraded from Ambari version <= 1.2.3, they will not have oozie_jdbc_connection_url
global
     var jdbcUrlInGlobal = this.get('globalConfigs').findProperty('name', 'oozie_jdbc_connection_url');
-    jdbcUrl.value = jdbcUrlInGlobal ? jdbcUrlInGlobal.value : defaultJdbcUrl;
+    jdbcUrl.set('value', jdbcUrlInGlobal ? jdbcUrlInGlobal.value : defaultJdbcUrl);
     return siteObj;
   },
 
@@ -1362,20 +1366,20 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     switch (hiveDb) {
       case 'New MySQL Database':
         defaultJdbcUrl = "jdbc:mysql://" + hiveHost + "/" + hiveDbName + "?createDatabaseIfNotExist=true";
-        jdbcDriver.value = "com.mysql.jdbc.Driver";
+        jdbcDriver.set('value',  'com.mysql.jdbc.Driver');
         break;
       case 'Existing MySQL Database':
         defaultJdbcUrl = "jdbc:mysql://" + hiveHost + "/" + hiveDbName + "?createDatabaseIfNotExist=true";
-        jdbcDriver.value = "com.mysql.jdbc.Driver";
+        jdbcDriver.set('value',  'com.mysql.jdbc.Driver');
         break;
       case 'Existing Oracle Database':
         defaultJdbcUrl = "jdbc:oracle:thin:@//" + hiveHost + ":1521/" + hiveDbName;
-        jdbcDriver.value = "oracle.jdbc.driver.OracleDriver";
+        jdbcDriver.set('value','oracle.jdbc.driver.OracleDriver');
         break;
     }
     // in case the user upgraded from Ambari <= 1.2.3, they will not have hive_jdbc_connection_url
global
     var jdbcUrlInGlobal = this.get('globalConfigs').findProperty('name', 'hive_jdbc_connection_url');
-    jdbcUrl.value = jdbcUrlInGlobal ? jdbcUrlInGlobal.value : defaultJdbcUrl;
+    jdbcUrl.set('value', jdbcUrlInGlobal ? jdbcUrlInGlobal.value : defaultJdbcUrl);
     return siteObj;
   },
 
@@ -1480,6 +1484,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
           globalConfigs.findProperty('name', 'hive_hostname').isVisible = true;
         }
         break;
+
       case 'OOZIE':
         var oozieServerHost = serviceConfigs.findProperty('name', 'oozieserver_host');
         oozieServerHost.defaultValue = this.get('content.hostComponents').findProperty('componentName',
'OOZIE_SERVER').get('host.hostName');

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5dfa54/ambari-web/app/controllers/main/service/reassign_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js
index 4da24b6..df53715 100644
--- a/ambari-web/app/controllers/main/service/reassign_controller.js
+++ b/ambari-web/app/controllers/main/service/reassign_controller.js
@@ -52,7 +52,7 @@ App.ReassignMasterController = App.WizardController.extend({
     advancedServiceConfig: null,
     controllerName: 'reassignMasterController',
     serviceName: 'MISC',
-    hdfsUser:"hdfs",
+    hdfsUser: "hdfs",
     reassign: null,
     componentsWithManualCommands: ['NAMENODE', 'SECONDARY_NAMENODE'],
     hasManualSteps: false,
@@ -60,7 +60,9 @@ App.ReassignMasterController = App.WizardController.extend({
   }),
 
   addManualSteps: function () {
-    this.set('content.hasManualSteps', this.get('content.componentsWithManualCommands').contains(this.get('content.reassign.component_name'))
|| this.get('content.securityEnabled'));
+    if (this.get('content.componentsWithManualCommands')) {  // While logging off this function
is called with content.componentsWithManualCommands undefined
+      this.set('content.hasManualSteps', this.get('content.componentsWithManualCommands').contains(this.get('content.reassign.component_name'))
|| this.get('content.securityEnabled'));
+    }
   }.observes('content.reassign.component_name', 'content.securityEnabled'),
 
   getSecurityStatus: function () {
@@ -113,19 +115,19 @@ App.ReassignMasterController = App.WizardController.extend({
    * return new object extended from clusterStatusTemplate
    * @return Object
    */
-  getCluster: function(){
+  getCluster: function () {
     return jQuery.extend({}, this.get('clusterStatusTemplate'), {name: App.router.getClusterName()});
   },
 
   /**
    * Load services data from server.
    */
-  loadServicesFromServer: function() {
+  loadServicesFromServer: function () {
     var displayOrderConfig = require('data/services');
     var apiUrl = App.get('stack2VersionURL');
     var apiService = this.loadServiceComponents(displayOrderConfig, apiUrl);
     //
-    apiService.forEach(function(item, index){
+    apiService.forEach(function (item, index) {
       apiService[index].isSelected = App.Service.find().someProperty('id', item.serviceName);
       apiService[index].isDisabled = apiService[index].isSelected;
       apiService[index].isInstalled = apiService[index].isSelected;
@@ -138,12 +140,12 @@ App.ReassignMasterController = App.WizardController.extend({
    * Load confirmed hosts.
    * Will be used at <code>Assign Masters(step5)</code> step
    */
-  loadConfirmedHosts: function(){
+  loadConfirmedHosts: function () {
     var hosts = App.db.getHosts();
-    if(!hosts || !hosts.length){
+    if (!hosts || !hosts.length) {
       var hosts = {};
 
-      App.Host.find().forEach(function(item){
+      App.Host.find().forEach(function (item) {
         hosts[item.get('id')] = {
           name: item.get('id'),
           cpu: item.get('cpu'),
@@ -165,9 +167,9 @@ App.ReassignMasterController = App.WizardController.extend({
    */
   loadMasterComponentHosts: function () {
     var masterComponentHosts = App.db.getMasterComponentHosts();
-    if(!masterComponentHosts){
+    if (!masterComponentHosts) {
       masterComponentHosts = [];
-      App.HostComponent.find().filterProperty('isMaster', true).forEach(function(item){
+      App.HostComponent.find().filterProperty('isMaster', true).forEach(function (item) {
         masterComponentHosts.push({
           component: item.get('componentName'),
           hostName: item.get('host.hostName'),
@@ -183,7 +185,7 @@ App.ReassignMasterController = App.WizardController.extend({
   /**
    * Load tasks statuses for step5 of Reassign Master Wizard to restore installation
    */
-  loadTasksStatuses: function(){
+  loadTasksStatuses: function () {
     var statuses = App.db.getReassignTasksStatuses();
     this.set('content.tasksStatuses', statuses);
     console.log('ReassignMasterController.loadTasksStatuses: loaded statuses', statuses);
@@ -244,69 +246,69 @@ App.ReassignMasterController = App.WizardController.extend({
     };
     App.db.setMasterToReassign(component);
   },
-  saveTasksStatuses: function(statuses){
+  saveTasksStatuses: function (statuses) {
     App.db.setReassignTasksStatuses(statuses);
     this.set('content.tasksStatuses', statuses);
     console.log('ReassignMasterController.saveTasksStatuses: saved statuses', statuses);
   },
 
-  loadRequestIds: function(){
+  loadRequestIds: function () {
     var requestIds = App.db.getReassignMasterWizardRequestIds();
     this.set('content.requestIds', requestIds);
   },
 
-  saveRequestIds: function(requestIds){
+  saveRequestIds: function (requestIds) {
     App.db.setReassignMasterWizardRequestIds(requestIds);
     this.set('content.requestIds', requestIds);
   },
 
-  saveLogs: function(logs){
+  saveLogs: function (logs) {
     App.db.setReassignMasterWizardLogs(logs);
     this.set('content.logs', logs);
   },
 
-  loadLogs: function(){
+  loadLogs: function () {
     var logs = App.db.getReassignMasterWizardLogs();
     this.set('content.logs', logs);
   },
 
-  saveComponentDir: function(componentDir){
+  saveComponentDir: function (componentDir) {
     App.db.setReassignMasterWizardComponentDir(componentDir);
     this.set('content.componentDir', componentDir);
   },
 
-  loadComponentDir: function(){
+  loadComponentDir: function () {
     var componentDir = App.db.getReassignMasterWizardComponentDir();
     this.set('content.componentDir', componentDir);
   },
 
-  saveReassignHosts: function(reassignHosts){
+  saveReassignHosts: function (reassignHosts) {
     App.db.setReassignMasterWizardReassignHosts(reassignHosts);
     this.set('content.reassignHosts', reassignHosts);
   },
 
-  loadReassignHosts: function(){
+  loadReassignHosts: function () {
     var reassignHosts = App.db.getReassignMasterWizardReassignHosts();
     this.set('content.reassignHosts', reassignHosts);
   },
 
 
-  saveSecurityEnabled: function(securityEnabled){
+  saveSecurityEnabled: function (securityEnabled) {
     this.setDBProperty('securityEnabled', securityEnabled);
     this.set('content.securityEnabled', securityEnabled);
   },
 
-  loadSecurityEnabled: function(){
+  loadSecurityEnabled: function () {
     var securityEnabled = this.getDBProperty('securityEnabled');
     this.set('content.securityEnabled', securityEnabled);
   },
 
-  saveSecureConfigs: function(secureConfigs){
+  saveSecureConfigs: function (secureConfigs) {
     this.setDBProperty('secureConfigs', secureConfigs);
     this.set('content.secureConfigs', secureConfigs);
   },
 
-  loadSecureConfigs: function(){
+  loadSecureConfigs: function () {
     var secureConfigs = this.getDBProperty('secureConfigs');
     this.set('content.secureConfigs', secureConfigs);
   },

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5dfa54/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index e797314..57408cf 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -385,7 +385,7 @@ App.config = Em.Object.create({
         configData = preDefined;
         if (isAdvanced) {
           var advanced = advancedConfigs.findProperty('name', configData.name);
-          configData.value = advanced.value;
+          configData.value = configData.displayType == "password" ? '' : advanced.value;
           configData.defaultValue = advanced.value;
           configData.filename = advanced.filename;
           configData.description = advanced.description;

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/0b5dfa54/ambari-web/app/views/wizard/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/controls_view.js b/ambari-web/app/views/wizard/controls_view.js
index de0ec4f..41fc3c6 100644
--- a/ambari-web/app/views/wizard/controls_view.js
+++ b/ambari-web/app/views/wizard/controls_view.js
@@ -36,7 +36,7 @@ App.ServiceConfigPopoverSupport = Ember.Mixin.create({
       App.popover(this.$(), {
         title: Em.I18n.t('installer.controls.serviceConfigPopover.title').format(
           this.get('serviceConfig.displayName'),
-          (this.get('serviceConfig.displayName') == this.get('serviceConfig.name'))?'':this.get('serviceConfig.name')
+          (this.get('serviceConfig.displayName') == this.get('serviceConfig.name')) ? ''
: this.get('serviceConfig.name')
         ),
         content: this.get('serviceConfig.description'),
         placement: 'right',
@@ -62,11 +62,11 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp
     }
   },
   //Set editDone true for last edited config text field parameter
-  focusOut: function(event){
+  focusOut: function (event) {
     this.get('serviceConfig').set("editDone", true);
   },
   //Set editDone false for all current category config text field parameter
-  focusIn: function(event){
+  focusIn: function (event) {
     if (!this.get('serviceConfig.selectedHostOptions')) {
       this.get("parentView.categoryConfigsAll").setEach("editDone", false);
     }
@@ -75,7 +75,7 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp
   textFieldClassName: function () {
     if (this.get('serviceConfig.unit')) {
       return ['input-small'];
-    } else if (this.get('serviceConfig.displayType') === 'principal'){
+    } else if (this.get('serviceConfig.displayType') === 'principal') {
       return ['span12'];
     } else {
       return ['span9'];
@@ -94,7 +94,7 @@ App.ServiceConfigTextField = Ember.TextField.extend(App.ServiceConfigPopoverSupp
  */
 App.ServiceConfigTextFieldWithUnit = Ember.View.extend(App.ServiceConfigPopoverSupport, {
   valueBinding: 'serviceConfig.value',
-  classNames: ['input-append','with-unit'],
+  classNames: ['input-append', 'with-unit'],
   placeholderBinding: 'serviceConfig.defaultValue',
 
   template: Ember.Handlebars.compile('{{view App.ServiceConfigTextField serviceConfigBinding="view.serviceConfig"
isPopoverEnabled="false"}}<span class="add-on">{{view.serviceConfig.unit}}</span>'),
@@ -259,26 +259,45 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
 
   hostName: function () {
     var value = this.get('serviceConfig.value');
-
+    var returnValue;
+    var hostname;
     if (this.get('serviceConfig.serviceName') === 'HIVE') {
       switch (value) {
         case 'New MySQL Database':
-          return this.get('categoryConfigsAll').findProperty('name', 'hive_ambari_host').get('value');
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_ambari_host');
+          break;
         case 'Existing MySQL Database':
-          return this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mysql_host').get('value');
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_mysql_host');
+          break;
         case 'Existing Oracle Database':
-          return this.get('categoryConfigsAll').findProperty('name', 'hive_existing_oracle_host').get('value');
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'hive_existing_oracle_host');
+          break;
+      }
+      if (hostname) {
+        returnValue = hostname.get('value');
+      } else {
+        returnValue = this.get('categoryConfigsAll').findProperty('name', 'hive_hostname').get('value');
       }
+
     } else if (this.get('serviceConfig.serviceName') === 'OOZIE') {
       switch (value) {
         case 'New Derby Database':
-          return this.get('categoryConfigsAll').findProperty('name', 'oozie_ambari_host').get('value');
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_ambari_host');
+          break;
         case 'Existing MySQL Database':
-          return this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mysql_host').get('value');
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_mysql_host');
+          break;
         case 'Existing Oracle Database':
-          return this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_oracle_host').get('value');
+          hostname = this.get('categoryConfigsAll').findProperty('name', 'oozie_existing_oracle_host');
+          break;
+      }
+      if (hostname) {
+        returnValue = hostname.get('value');
+      } else {
+        returnValue = this.get('categoryConfigsAll').findProperty('name', 'oozie_hostname').get('value');
       }
     }
+    return returnValue;
   }.property('serviceConfig.serviceName', 'serviceConfig.value', 'configs.@each.value'),
 
   connectionUrl: function () {


Mime
View raw message