ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject git commit: AMBARI-6443. Add Service Wizard: Hive "Database host" config empty and disabled. (Buzhor Denys via alexantonenko)
Date Wed, 09 Jul 2014 20:14:34 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 673f649b0 -> 3b62427a4


AMBARI-6443. Add Service Wizard: Hive "Database host" config empty and disabled. (Buzhor Denys
via alexantonenko)


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

Branch: refs/heads/trunk
Commit: 3b62427a414fd461f18495bf9d83fc5f16c5342a
Parents: 673f649
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Jul 9 23:14:12 2014 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Jul 9 23:14:12 2014 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/configs.js    | 29 +++++++++++++----
 .../app/controllers/wizard/step7_controller.js  | 22 ++++++++++++-
 .../app/controllers/wizard/step8_controller.js  | 33 +------------------
 ambari-web/app/data/HDP2/global_properties.js   |  4 ---
 ambari-web/app/data/global_properties.js        | 34 ++++++++------------
 ambari-web/app/views/wizard/controls_view.js    |  7 +++-
 6 files changed, 65 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3b62427a/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 0db4b50..5f4c977 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -340,6 +340,16 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     App.config.loadServiceConfigGroupOverrides(allConfigs, this.loadedGroupToOverrideSiteToTagMap,
this.get('configGroups'), this.onLoadOverrides, this);
   }.observes('selectedConfigGroup'),
 
+  checkDatabaseProperties: function (serviceConfig) {
+    if (!['OOZIE', 'HIVE'].contains(this.get('content.serviceName'))) return;
+    var configsToHide = ['oozie_hostname'];
+    configsToHide.forEach(function(configName) {
+      var property = serviceConfig.configs.findProperty('name', configName);
+      if (property) property.set('isVisible', false);
+    });
+  },
+
+
   onLoadOverrides: function (allConfigs) {
     var serviceName = this.get('content.serviceName');
     var advancedConfigs = this.get('advancedConfigs');
@@ -357,6 +367,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       this.setRecommendedDefaults(advancedConfigs).done(function () {
         self.loadConfigs(allConfigs, serviceConfig);
         self.checkOverrideProperty(serviceConfig);
+        self.checkDatabaseProperties(serviceConfig);
         self.get('stepConfigs').pushObject(serviceConfig);
         self.set('selectedService', self.get('stepConfigs').objectAt(0));
         self.checkForSecureConfig(self.get('selectedService'));
@@ -627,7 +638,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
     });
     return dfd.promise();
   },
-
   /**
    * set isEditable property of config for admin
    * if default cfg group and not on the host config page
@@ -1199,6 +1209,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
    * @param globals
    */
   setOozieHostName: function (globals) {
+    var dbHostPropertyName = null;
     if (globals.someProperty('name', 'oozie_database')) {
       var oozieDb = globals.findProperty('name', 'oozie_database');
       if (oozieDb.value === 'New Derby Database') {
@@ -1226,7 +1237,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       } else if (oozieDb.value === 'Existing MySQL Database') {
         var existingMySqlHost = globals.findProperty('name', 'oozie_existing_mysql_host');
         if (existingMySqlHost) {
-          existingMySqlHost.name = 'oozie_hostname';
+          dbHostPropertyName = 'oozie_existing_mysql_host';
         }
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
@@ -1238,7 +1249,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       } else if (oozieDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql'))
{
         var existingPostgreSqlHost = globals.findProperty('name', 'oozie_existing_postgresql_host');
         if (existingPostgreSqlHost) {
-          existingPostgreSqlHost.name = 'oozie_hostname';
+          dbHostPropertyName = 'oozie_existing_postgresql_host';
         }
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
@@ -1250,7 +1261,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       else { //existing oracle database
         var existingOracleHost = globals.findProperty('name', 'oozie_existing_oracle_host');
         if (existingOracleHost) {
-          existingOracleHost.name = 'oozie_hostname';
+          dbHostPropertyName = 'oozie_existing_oracle_host';
         }
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
@@ -1260,6 +1271,12 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
       }
 
     }
+
+    if (dbHostPropertyName) {
+      var oozieHostNameProperty = App.ServiceConfigProperty.create(App.config.get('preDefinedGlobalProperties').findProperty('name','oozie_hostname'));
+      oozieHostNameProperty.set('value', globals.findProperty('name', dbHostPropertyName).get('value'));
+      globals.pushObject(oozieHostNameProperty);
+    }
   },
 
   /**
@@ -1778,13 +1795,13 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
 
     if (serviceName === 'HIVE') {
       var hiveDb = globalConfigs.findProperty('name', 'hive_database').value;
-      if (['Existing MySQL Database', 'Existing Oracle Database'].contains(hiveDb)) {
+      if (['Existing MySQL Database', 'Existing Oracle Database', 'Existing PostgreSQL Database'].contains(hiveDb))
{
         globalConfigs.findProperty('name', 'hive_hostname').isVisible = true;
       }
     }
     if (serviceName === 'OOZIE') {
       var oozieDb = globalConfigs.findProperty('name', 'oozie_database').value;
-      if (['Existing MySQL Database', 'Existing Oracle Database'].contains(oozieDb)) {
+      if (['Existing MySQL Database', 'Existing Oracle Database', 'Existing PostgreSQL Database'].contains(oozieDb))
{
         globalConfigs.findProperty('name', 'oozie_hostname').isVisible = true;
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b62427a/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 6dcbdae..cb3bec3 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -819,6 +819,7 @@ App.WizardStep7Controller = Em.Controller.extend({
       }
     });
 
+    this.setServiceDatabaseConfigs(configs);
     //add user properties
     for (var name in configsMap) {
       configs.push(configMixin.addUserProperty({
@@ -838,7 +839,26 @@ App.WizardStep7Controller = Em.Controller.extend({
       }, false, []));
     }
   },
-
+  /**
+   * Check if Oozie or Hive use existing database then need
+   * to restore missed properties
+   *
+   * @param {Object[]} configs
+   **/
+  setServiceDatabaseConfigs: function(configs) {
+    var serviceNames = this.get('installedServiceNames').filter(function(serviceName) {
+      return ['OOZIE', 'HIVE'].contains(serviceName);
+    });
+    serviceNames.forEach(function(serviceName) {
+      var dbTypeConfig = configs.findProperty('name', serviceName.toLowerCase() + '_database');
+      if (!/existing/gi.test(dbTypeConfig.value)) return;
+      var dbHostName = serviceName.toLowerCase() + '_hostname';
+      var database = dbTypeConfig.value.match(/MySQL|PostgreSQL|Oracle|Derby/gi)[0];
+      var existingDBConfig = configs.findProperty('name', serviceName.toLowerCase() + '_existing_'
+ database.toLowerCase() + '_host');
+      if (!existingDBConfig.value)
+        existingDBConfig.value = existingDBConfig.defaultValue = configs.findProperty('name',
dbHostName).value;
+    }, this);
+  },
   /**
    * Add group ids to <code>groupsToDelete</code>
    * Also save <code>groupsToDelete</code> to local storage

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b62427a/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index 3163531..f58c602 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -858,37 +858,6 @@ App.WizardStep8Controller = Em.Controller.extend({
       return this.submitProceed();
     }
   },
-
-  /**
-   * Update configurations for installed services.
-   * Do separated PUT-request for each siteName for each service
-   *
-   * @param {Array} configsToUpdate - configs need to update
-   * Format:
-   * <code>
-   *   [
-   *    {serviceName: 's1', id: 'site property', filename: 'f1.xml', name: 'n1', value: 'v1'},
-   *    {serviceName: 's2', id: 'site property', filename: 'f1.xml', name: 'n2', value: 'v2'},
-   *    {serviceName: 's2', id: '', filename: 'f2.xml', name: 'n3', value: 'v3'}
-   *   ]
-   * </code>
-   * @method updateConfigurations
-   */
-  updateConfigurations: function (configsToUpdate) {
-    var configurationController = App.router.get('mainServiceInfoConfigsController');
-    var serviceNames = configsToUpdate.mapProperty('serviceName').uniq();
-    serviceNames.forEach(function (serviceName) {
-      var configs = configsToUpdate.filterProperty('serviceName', serviceName);
-      configurationController.setNewTagNames(configs);
-      var tagName = configs.objectAt(0).newTagName;
-      var siteConfigs = configs.filterProperty('id', 'site property');
-      siteConfigs.mapProperty('filename').uniq().forEach(function (siteName) {
-        var formattedConfigs = configurationController.createSiteObj(siteName.replace(".xml",
""), tagName, configs.filterProperty('filename', siteName));
-        configurationController.doPUTClusterConfigurationSite(formattedConfigs);
-      });
-    });
-  },
-
   /**
    * Prepare <code>ajaxQueue</code> and start to execute it
    * @method submitProceed
@@ -1003,7 +972,7 @@ App.WizardStep8Controller = Em.Controller.extend({
   deleteClustersCallback: function (response, request, data) {
     if (data.isLast) {
       if (this.get('wizardController').getDBProperty('configsToUpdate')) {
-        this.updateConfigurations(this.get('wizardController').getDBProperty('configsToUpdate'));
+        $.extend(true, this.get('configs'), this.get('wizardController').getDBProperty('configsToUpdate'));
       }
       this.setLocalRepositories();
       this.createCluster();

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b62427a/ambari-web/app/data/HDP2/global_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/global_properties.js b/ambari-web/app/data/HDP2/global_properties.js
index 3d9d5d6..09ba19a 100644
--- a/ambari-web/app/data/HDP2/global_properties.js
+++ b/ambari-web/app/data/HDP2/global_properties.js
@@ -783,7 +783,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "displayType": "host",
       "isOverridable": false,
       "isRequiredByAgent": false,
@@ -1089,7 +1088,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "isOverridable": false,
       "displayType": "host",
       "isVisible": false,
@@ -1104,7 +1102,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "isOverridable": false,
       "displayType": "host",
       "isVisible": false,
@@ -1119,7 +1116,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "isOverridable": false,
       "displayType": "host",
       "isVisible": false,

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b62427a/ambari-web/app/data/global_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/global_properties.js b/ambari-web/app/data/global_properties.js
index f61d354..bdd05bf 100644
--- a/ambari-web/app/data/global_properties.js
+++ b/ambari-web/app/data/global_properties.js
@@ -734,7 +734,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "displayType": "host",
       "isRequiredByAgent": false,
       "isOverridable": false,
@@ -750,7 +749,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "displayType": "host",
       "isOverridable": false,
       "isRequiredByAgent": false,
@@ -761,21 +759,20 @@ module.exports =
       "index": 3
     },
     {
-        "id": "puppet var",
-        "name": "hive_existing_postgresql_host",
-        "displayName": "Database Host",
-        "description": "Specify the host on which the existing database is hosted",
-        "defaultValue": "",
-        "isReconfigurable": false,
-        "displayType": "host",
-        "isOverridable": false,
-        "isRequiredByAgent": false,
-        "isVisible": false,
-        "isObserved": true,
-        "serviceName": "HIVE",
-        "category": "HIVE_METASTORE",
-        "index": 3
-      },
+      "id": "puppet var",
+      "name": "hive_existing_postgresql_host",
+      "displayName": "Database Host",
+      "description": "Specify the host on which the existing database is hosted",
+      "defaultValue": "",
+      "displayType": "host",
+      "isOverridable": false,
+      "isRequiredByAgent": false,
+      "isVisible": false,
+      "isObserved": true,
+      "serviceName": "HIVE",
+      "category": "HIVE_METASTORE",
+      "index": 3
+    },
     {
       "id": "puppet var",
       "name": "hive_ambari_host",
@@ -1021,7 +1018,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "isOverridable": false,
       "displayType": "host",
       "isRequiredByAgent": false,
@@ -1037,7 +1033,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "isOverridable": false,
       "displayType": "host",
       "isRequiredByAgent": false,
@@ -1053,7 +1048,6 @@ module.exports =
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
       "defaultValue": "",
-      "isReconfigurable": false,
       "isOverridable": false,
       "isRequiredByAgent": false,
       "displayType": "host",

http://git-wip-us.apache.org/repos/asf/ambari/blob/3b62427a/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 031d887..8fb971a 100644
--- a/ambari-web/app/views/wizard/controls_view.js
+++ b/ambari-web/app/views/wizard/controls_view.js
@@ -203,6 +203,7 @@ App.ServiceConfigRadioButtons = Ember.View.extend({
   },
 
   configs: function () {
+    if (this.get('controller.name') == 'mainServiceInfoConfigsController') return this.get('categoryConfigsAll');
     return this.get('categoryConfigsAll').filterProperty('isObserved', true);
   }.property('categoryConfigsAll'),
 
@@ -735,6 +736,9 @@ App.CheckDBConnectionView = Ember.View.extend({
   pollInterval: 3000,
   /** @property {string} hostNameProperty - host name property based on service and database
names **/
   hostNameProperty: function() {
+    if (!/wizard/i.test(this.get('controller.name')) && this.get('parentView.service.serviceName')
=== 'HIVE') {
+      return this.get('parentView.service.serviceName').toLowerCase() + '_hostname';
+    }
     return '{0}_existing_{1}_host'.format(this.get('parentView.service.serviceName').toLowerCase(),
this.get('databaseName').toLowerCase());
   }.property('databaseName'),
   /** @property {boolean} isBtnDisabled - disable button on failed validation or active request
**/
@@ -808,7 +812,8 @@ App.CheckDBConnectionView = Ember.View.extend({
     var properties = [].concat(this.get('requiredProperties'));
     properties.push(this.get('hostNameProperty'));
     properties.forEach(function(propertyName) {
-      if(!this.get('parentView.categoryConfigsAll').findProperty('name', propertyName).get('isValid'))
isValid = false;
+      var property = this.get('parentView.categoryConfigsAll').findProperty('name', propertyName);
+      if(property && !property.get('isValid')) isValid = false;
     }, this);
     this.set('isValidationPassed', isValid);
   }.observes('parentView.categoryConfigsAll.@each.isValid', 'parentView.categoryConfigsAll.@each.value',
'databaseName'),


Mime
View raw message