incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject svn commit: r1488461 - in /incubator/ambari/trunk/ambari-web/app: controllers/main/service/info/configs.js controllers/wizard/step8_controller.js data/config_mapping.js data/config_properties.js views/main/service/info/summary.js
Date Sat, 01 Jun 2013 04:49:41 GMT
Author: yusaku
Date: Sat Jun  1 04:49:41 2013
New Revision: 1488461

URL: http://svn.apache.org/r1488461
Log:
AMBARI-2249. Allow users to edit Hive Metastore and Oozie database post-install. (yusaku)

Modified:
    incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
    incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
    incubator/ambari/trunk/ambari-web/app/data/config_mapping.js
    incubator/ambari/trunk/ambari-web/app/data/config_properties.js
    incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js

Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js?rev=1488461&r1=1488460&r2=1488461&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js Sat Jun
 1 04:49:41 2013
@@ -1388,6 +1388,11 @@ App.MainServiceInfoConfigsController = E
   createSiteObj: function (siteName, tagName) {
     var siteObj = this.get('uiConfigs').filterProperty('filename', siteName + '.xml');
     var siteProperties = {};
+    if (siteName == 'oozie-site') {
+      siteObj = this.getOozieSiteObj(siteObj);
+    } else if (siteName == 'hive-site') {
+      siteObj = this.getHiveSiteObj(siteObj);
+    }
     siteObj.forEach(function (_siteObj) {
       siteProperties[_siteObj.name] = _siteObj.value;
       this.recordHostOverride(_siteObj, siteName, tagName, this);
@@ -1396,7 +1401,68 @@ App.MainServiceInfoConfigsController = E
   },
 
   /**
-   * Set display names of the property tfrom he puppet/global names
+   * create site object for Oozie
+   * @param siteObj
+   * @return {Object}
+   */
+  getOozieSiteObj: function (siteObj) {
+    var jdbcUrl = siteObj.findProperty('name', 'oozie.service.JPAService.jdbc.url');
+    var jdbcDriver = siteObj.findProperty('name', 'oozie.service.JPAService.jdbc.driver');
+
+    var oozieDb = this.get('globalConfigs').findProperty('name', 'oozie_database').value;
+    // oozieHost is undefined if the database is oozie
+    var oozieHost = (oozieDb == 'New Derby Database') ? '' : this.get('globalConfigs').findProperty('name',
'oozie_hostname').value;
+    var oozieDbName = this.get('globalConfigs').findProperty('name', 'oozie_database_name').value;
+
+    switch (oozieDb) {
+      case 'New Derby Database':
+        jdbcUrl.value = "jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true";
+        jdbcDriver.value = "org.apache.derby.jdbc.EmbeddedDriver";
+        break;
+      case 'Existing MySQL Database':
+        jdbcUrl.value = "jdbc:mysql://" + oozieHost + "/" + oozieDbName;
+        jdbcDriver.value = "com.mysql.jdbc.Driver";
+        break;
+      case 'Existing Oracle Database':
+        jdbcUrl.value = "jdbc:oracle:thin:@//" + oozieHost + ":1521/" + oozieDbName;
+        jdbcDriver.value = "oracle.jdbc.driver.OracleDriver";
+        break;
+    }
+    return siteObj;
+  },
+
+  /**
+   * create site object for Hive
+   * @param siteObj
+   * @return {Object}
+   */
+  getHiveSiteObj: function (siteObj) {
+    var jdbcUrl = siteObj.findProperty('name', 'javax.jdo.option.ConnectionURL');
+    var jdbcDriver = siteObj.findProperty('name', 'javax.jdo.option.ConnectionDriverName');
+
+    var hiveDb = this.get('globalConfigs').findProperty('name', 'hive_database').value;
+    var hiveHost = this.get('globalConfigs').findProperty('name', 'hive_hostname').value;
+    var hiveDbName = this.get('globalConfigs').findProperty('name', 'hive_database_name').value;
+
+    switch (hiveDb) {
+      case 'New MySQL Database':
+        jdbcUrl.value = "jdbc:mysql://"+ hiveHost + "/" + hiveDbName + "?createDatabaseIfNotExist=true";
+        jdbcDriver.value = "com.mysql.jdbc.Driver";
+        break;
+      case 'Existing MySQL Database':
+        jdbcUrl.value = "jdbc:mysql://"+ hiveHost + "/" + hiveDbName + "?createDatabaseIfNotExist=true";
+        jdbcDriver.value = "com.mysql.jdbc.Driver";
+        break;
+      case 'Existing Oracle Database':
+        jdbcUrl.value = "jdbc:oracle:thin:@//"+ hiveHost + ":1521/" + hiveDbName;
+        jdbcDriver.value = "oracle.jdbc.driver.OracleDriver";
+        break;
+    }
+    return siteObj;
+  },
+
+  /**
+   * Set display names of the property from the puppet/global names
    * @param: displayNames: a field to be set with displayNames
    * @param names: array of property puppet/global names
    */
@@ -1469,11 +1535,19 @@ App.MainServiceInfoConfigsController = E
         var hiveMetastoreHost = serviceConfigs.findProperty('name', 'hivemetastore_host');
         hiveMetastoreHost.defaultValue = this.get('content.hostComponents').findProperty('componentName',
'HIVE_SERVER').get('host.hostName');
         globalConfigs.push(hiveMetastoreHost);
+        var hiveDb = globalConfigs.findProperty('name', 'hive_database').value;
+        if (['Existing MySQL Database', 'Existing Oracle Database'].contains(hiveDb)) {
+          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');
         globalConfigs.push(oozieServerHost);
+        var oozieDb = globalConfigs.findProperty('name', 'oozie_database').value;
+        if (['Existing MySQL Database', 'Existing Oracle Database'].contains(oozieDb)) {
+          globalConfigs.findProperty('name', 'oozie_hostname').isVisible = true;
+        }
         break;
       case 'HBASE':
         var hbaseMasterHost = serviceConfigs.findProperty('name', 'hbasemaster_host');

Modified: incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js?rev=1488461&r1=1488460&r2=1488461&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js Sat Jun 
1 04:49:41 2013
@@ -86,7 +86,7 @@ App.WizardStep8Controller = Em.Controlle
 
       if (hiveDb.value === 'New MySQL Database') {
         if (globals.someProperty('name', 'hive_ambari_host')) {
-          globals.findProperty('name', 'hive_ambari_host').name = 'hive_hostname';
+          globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name',
'hive_ambari_host').value;
           hiveDbType.value = 'mysql';
           hiveJdbcDriver.value = 'com.mysql.jdbc.Driver';
         }
@@ -95,15 +95,15 @@ App.WizardStep8Controller = Em.Controlle
         globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
       } else if (hiveDb.value === 'Existing MySQL Database'){
-        globals.findProperty('name', 'hive_existing_mysql_host').name = 'hive_hostname';
+        globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name',
'hive_existing_mysql_host').value;
         hiveDbType.value = 'mysql';
         hiveJdbcDriver.value = 'com.mysql.jdbc.Driver';
         globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
         globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
-      } else{ //existing oracle database
-        globals.findProperty('name', 'hive_existing_oracle_host').name = 'hive_hostname';
+      } else { //existing oracle database
+        globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name',
'hive_existing_oracle_host').value;
         hiveDbType.value = 'oracle';
         hiveJdbcDriver.value = 'oracle.jdbc.driver.OracleDriver';
         globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
@@ -119,46 +119,30 @@ App.WizardStep8Controller = Em.Controlle
       var oozieDb = globals.findProperty('name', 'oozie_database');
       var oozieDbType = {name:'oozie_database_type'};
       var oozieJdbcDriver = {name: 'oozie_jdbc_driver'};
-      var oozieJPAServcieURL = {name: 'oozie_JPAService_url'};
 
-      if (oozieDb.value === 'New Derby Database'){
+      if (oozieDb.value === 'New Derby Database') {
+        globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name',
'oozie_ambari_host').value;
         oozieDbType.value = 'derby';
         oozieJdbcDriver.value = 'org.apache.derby.jdbc.EmbeddedDriver';
-        oozieJPAServcieURL.value = '${oozie.data.dir}/${oozie.db.schema.name}-db;create=true';
-
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
-      }/*else if (oozieDb.value === 'New MySQL Database') {
-        if (globals.someProperty('name', 'oozie_ambari_host')) {
-          globals.findProperty('name', 'oozie_ambari_host').name = 'oozie_hostname';
-          oozieDbType.value = 'mysql';
-          oozieJdbcDriver.value = 'com.mysql.jdbc.Driver';
-          oozieJPAServcieURL.value = '//'+ globals.findProperty('name','oozie_hostname').value
+'/' + globals.findProperty('name','oozie_database_name').value +'?createDatabaseIfNotExist=true';
-        }
-        globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
-        globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
-        globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
-        globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
-        globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
-      } */ else if (oozieDb.value === 'Existing MySQL Database') {
-        globals.findProperty('name', 'oozie_existing_mysql_host').name = 'oozie_hostname';
+      } else if (oozieDb.value === 'Existing MySQL Database') {
+        globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name',
'oozie_existing_mysql_host').value;
         oozieDbType.value = 'mysql';
         oozieJdbcDriver.value = 'com.mysql.jdbc.Driver';
-        oozieJPAServcieURL.value = '//'+ globals.findProperty('name','oozie_hostname').value
+'/' + globals.findProperty('name','oozie_database_name').value +'?createDatabaseIfNotExist=true';
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
-      } else{ //existing oracle database
-        globals.findProperty('name', 'oozie_existing_oracle_host').name = 'oozie_hostname';
+      } else { // existing oracle database
+        globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name',
'oozie_existing_oracle_host').value;
         oozieDbType.value = 'oracle';
         oozieJdbcDriver.value = 'oracle.jdbc.driver.OracleDriver';
-        oozieJPAServcieURL.value = '//'+ globals.findProperty('name','oozie_hostname').value
+'/'+ globals.findProperty('name','oozie_database_name').value +'?createDatabaseIfNotExist=true';
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
         globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
         globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
@@ -167,7 +151,6 @@ App.WizardStep8Controller = Em.Controlle
       }
       globals.push(oozieDbType);
       globals.push(oozieJdbcDriver);
-      globals.push(oozieJPAServcieURL);
     }
 
     this.set('globals', globals);
@@ -1478,18 +1461,12 @@ App.WizardStep8Controller = Em.Controlle
     var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet
var');
     if (globals.someProperty('name', 'oozie_database')) {
       var oozieDb = globals.findProperty('name', 'oozie_database');
-      var oozieHost = null;
-      if(globals.someProperty('name', 'oozie_hostname')){
-        oozieHost = globals.findProperty('name', 'oozie_hostname').value;
-      }
+      var oozieHost = globals.findProperty('name', 'oozie_hostname').value;
       var oozieDbName = globals.findProperty('name', 'oozie_database_name').value;
-      if (oozieDb.value === 'New Derby Database'){
+      if (oozieDb.value === 'New Derby Database') {
         oozieProperties["oozie.service.JPAService.jdbc.url"] = "jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true";
         oozieProperties["oozie.service.JPAService.jdbc.driver"] = "org.apache.derby.jdbc.EmbeddedDriver";
-      }/*else if (oozieDb.value === 'New MySQL Database') {
-        oozieProperties["oozie.service.JPAService.jdbc.url"] = "jdbc:mysql://" + oozieHost
+ "/" + oozieDbName;
-        oozieProperties["oozie.service.JPAService.jdbc.driver"] = "com.mysql.jdbc.Driver";
-      } */ else if (oozieDb.value === 'Existing MySQL Database') {
+      } else if (oozieDb.value === 'Existing MySQL Database') {
         oozieProperties["oozie.service.JPAService.jdbc.url"] = "jdbc:mysql://" + oozieHost
+ "/" + oozieDbName;
         oozieProperties["oozie.service.JPAService.jdbc.driver"] = "com.mysql.jdbc.Driver";
       } else { //existing oracle database

Modified: incubator/ambari/trunk/ambari-web/app/data/config_mapping.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/config_mapping.js?rev=1488461&r1=1488460&r2=1488461&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/config_mapping.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/config_mapping.js Sat Jun  1 04:49:41 2013
@@ -317,6 +317,56 @@ var configs = [
     "filename": "oozie-site.xml"
   },
   {
+    "name": "oozie.service.JPAService.create.db.schema",
+    "templateName": [],
+    "foreignKey": null,
+    "value": "false",  // this is always false
+    "filename": "oozie-site.xml"
+  },
+  {
+    "name": "oozie.db.schema.name",
+    "templateName": ['oozie_database_name'],
+    "foreignKey": null,
+    "value": "<templateName[0]>",
+    "filename": "oozie-site.xml"
+  },
+  {
+    "name": "oozie.service.JPAService.jdbc.driver",
+    "templateName": [],
+    "foreignKey": null,
+    "value": "org.apache.derby.jdbc.EmbeddedDriver",  // this value is overwritten in code
+    "filename": "oozie-site.xml"
+  },
+  {
+    "name": "oozie.service.JPAService.jdbc.username",
+    "templateName": ['oozie_metastore_user_name'],
+    "foreignKey": null,
+    "value": "<templateName[0]>",
+    "filename": "oozie-site.xml"
+  },
+  {
+    "name": "oozie.service.JPAService.jdbc.password",
+    "templateName": ['oozie_metastore_user_passwd'],
+    "foreignKey": null,
+    "value": "<templateName[0]>",
+    "filename": "oozie-site.xml"
+  },
+  // oozie.service.JPAService.jdbc.url value is set in code
+  {
+    "name": "oozie.service.JPAService.jdbc.url",
+    "templateName": [],
+    "foreignKey": null,
+    "value": "jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true",  // this
value is overwritten in code
+    "filename": "oozie-site.xml"
+  },
+  {
+    "name": "javax.jdo.option.ConnectionDriverName",
+    "templateName": [],
+    "foreignKey": null,
+    "value": "com.mysql.jdbc.Driver",  // this value is overwritten in code
+    "filename": "hive-site.xml"
+  },
+  {
     "name": "javax.jdo.option.ConnectionUserName",
     "templateName": ["hive_metastore_user_name"],
     "foreignKey": null,
@@ -330,7 +380,13 @@ var configs = [
     "value": "<templateName[0]>",
     "filename": "hive-site.xml"
   },
-
+  {
+    "name": "javax.jdo.option.ConnectionURL",
+    "templateName": [],
+    "foreignKey": null,
+    "value": "",  // this value is overwritten in code
+    "filename": "hive-site.xml"
+  },
   {
     "name": "hive.metastore.uris",
     "templateName": ["hivemetastore_host"],

Modified: incubator/ambari/trunk/ambari-web/app/data/config_properties.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/config_properties.js?rev=1488461&r1=1488460&r2=1488461&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/config_properties.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/config_properties.js Sat Jun  1 04:49:41 2013
@@ -1306,6 +1306,21 @@ module.exports =
     },
     {
       "id": "puppet var",
+      "name": "hive_hostname",
+      "displayName": "Database Host",
+      "description": "Specify the host on which the database is hosted",
+      "defaultValue": "",
+      "isReconfigurable": true,
+      "displayType": "host",
+      "isOverridable": false,
+      "isVisible": false,
+      "domain": "global",
+      "serviceName": "HIVE",
+      "category": "Hive Metastore",
+      "index": 3
+    },
+    {
+      "id": "puppet var",
       "name": "hive_existing_mysql_host",
       "displayName": "Database Host",
       "description": "Specify the host on which the existing database is hosted",
@@ -1340,7 +1355,7 @@ module.exports =
       "value": "",
       "defaultValue": "",
       "displayName": "Database Host",
-      "description": "Host on which the database will be created by Ambari",
+      "description": "The host where Hive Metastore database is located",
       "isReconfigurable": false,
       "displayType": "masterHost",
       "isOverridable": false,
@@ -1356,7 +1371,7 @@ module.exports =
       "displayName": "Database Name",
       "description": "Database name used as the Hive Metastore",
       "defaultValue": "hive",
-      "isReconfigurable": false,
+      "isReconfigurable": true,
       "displayType": "host",
       "isOverridable": false,
       "isVisible": true,
@@ -1371,7 +1386,7 @@ module.exports =
       "displayName": "Database Username",
       "description": "Database user name to use to connect to the database",
       "defaultValue": "hive",
-      "isReconfigurable": false,
+      "isReconfigurable": true,
       "displayType": "user",
       "isOverridable": false,
       "isVisible": true,
@@ -1386,7 +1401,7 @@ module.exports =
       "displayName": "Database Password",
       "description": "Database password to use to connect to the PostgreSQL database",
       "defaultValue": "",
-      "isReconfigurable": false,
+      "isReconfigurable": true,
       "displayType": "password",
       "isOverridable": false,
       "isVisible": true,
@@ -1666,6 +1681,21 @@ module.exports =
       "category": "Oozie Server",
       "index": 2
     },
+    {
+      "id": "puppet var",
+      "name": "oozie_hostname",
+      "defaultValue": "",
+      "displayName": "Database Host",
+      "description": "The host where the Oozie database is located",
+      "isReconfigurable": true,
+      "isOverridable": false,
+      "displayType": "host",
+      "isVisible": false,
+      "domain": "global",
+      "serviceName": "OOZIE",
+      "category": "Oozie Server",
+      "index": 3
+    },
       {
           "id": "puppet var",
           "name": "oozie_existing_mysql_host",
@@ -1718,7 +1748,7 @@ module.exports =
           "displayName": "Database Name",
           "description": "Database name used for the Oozie",
           "defaultValue": "oozie",
-          "isReconfigurable": false,
+          "isReconfigurable": true,
           "isOverridable": false,
           "displayType": "host",
           "isVisible": true,
@@ -1733,7 +1763,7 @@ module.exports =
           "displayName": "Database Username",
           "description": "Database user name to use to connect to the database",
           "defaultValue": "oozie",
-          "isReconfigurable": false,
+          "isReconfigurable": true,
           "isOverridable": false,
           "displayType": "user",
           "isVisible": true,
@@ -1748,7 +1778,7 @@ module.exports =
           "displayName": "Database Password",
           "description": "Database password to use to connect to the database",
           "defaultValue": "",
-          "isReconfigurable": false,
+          "isReconfigurable": true,
           "isOverridable": false,
           "displayType": "password",
           "isVisible": true,

Modified: incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js?rev=1488461&r1=1488460&r2=1488461&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js (original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js Sat Jun  1 04:49:41
2013
@@ -216,7 +216,12 @@ App.MainServiceInfoSummaryView = Em.View
           }
         }
         obj.displayName = component.get('displayName'); // this is computed property and
wasn't copied in the top block of code
-        components.push(obj);
+        // suppressing MySQL server from being displayed, because Ambari always installs
MySQL server no matter what
+        // database type is selected, and shows an incorrect link in the summary to point
to the host that's hosting
+        // the MySQL server
+        if (component.get('componentName') !== 'MYSQL_SERVER') {
+          components.push(obj);
+        }
       });
       this.set('components', components);
   }.observes('controller.content.rand', 'controller.content.hostComponents.@each.isMaster',
'controller.content.hostComponents.@each.host'),



Mime
View raw message