ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [2/2] ambari git commit: AMBARI-9655. Added Second Hive Metastore, two alert instances but both OK (alexantonenko)
Date Mon, 16 Feb 2015 00:24:39 GMT
AMBARI-9655. Added Second Hive Metastore, two alert instances but both OK (alexantonenko)


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

Branch: refs/heads/trunk
Commit: bff7124bb934005cee93c13cd93226bb9c1609ea
Parents: f7a1327
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Mon Feb 16 01:24:25 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Mon Feb 16 02:18:01 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 102 ++++++++++++-------
 ambari-web/app/controllers/main/service/item.js |  11 +-
 ambari-web/app/utils/components.js              |   7 +-
 3 files changed, 81 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bff7124b/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 7d1d29e..2eccd7d 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -44,6 +44,12 @@ App.MainHostDetailsController = Em.Controller.extend({
   referer: '',
 
   /**
+   *  Host on which Hive Metastore will be added
+   * @type {string}
+   */
+  hiveMetastoreHost: '',
+
+  /**
    * Deferred object will be resolved when Oozie configs are downloaded
    * @type {object}
    */
@@ -427,13 +433,16 @@ App.MainHostDetailsController = Em.Controller.extend({
    * @method addComponent
    */
   addComponent: function (event) {
-    var self = this;
-    var component = event.context;
-    var componentName = component.get('componentName');
-    var missedComponents = componentsUtils.checkComponentDependencies(componentName, {
-      scope: 'host',
-      installedComponents: this.get('content.hostComponents').mapProperty('componentName')
-    });
+    var
+      returnFunc,
+      self = this,
+      hiveHost = event.hiveMetastoreHost ? event.hiveMetastoreHost : "";
+      component = event.context,
+      componentName = component.get('componentName'),
+      missedComponents = !!hiveHost ? [] : componentsUtils.checkComponentDependencies(componentName,
{
+        scope: 'host',
+        installedComponents: this.get('content.hostComponents').mapProperty('componentName')
+      });
     if (!!missedComponents.length) {
       var popupMessage = Em.I18n.t('host.host.addComponent.popup.dependedComponents.body').format(component.get('displayName'),
         stringUtils.getFormattedStringFromArray(missedComponents.map(function(cName) {
@@ -441,20 +450,28 @@ App.MainHostDetailsController = Em.Controller.extend({
         })));
       return App.showAlertPopup(Em.I18n.t('host.host.addComponent.popup.dependedComponents.header'),
popupMessage);
     }
-    if (componentName === 'ZOOKEEPER_SERVER' || componentName === 'HIVE_METASTORE') {
-      return App.showConfirmationPopup(function () {
-        self.primary(component);
-      }, Em.I18n.t('hosts.host.addComponent.' + componentName ));
-    } else {
-      if (this.get('securityEnabled') && componentName !== 'CLIENTS') {
-        return App.showConfirmationPopup(function () {
+
+    switch (componentName) {
+      case 'ZOOKEEPER_SERVER':
+        returnFunc = App.showConfirmationPopup(function () {
           self.primary(component);
-        }, Em.I18n.t('hosts.host.addComponent.securityNote').format(componentName, self.get('content.hostName')));
-      }
-      else {
-        return this.addClientComponent(component);
-      }
+        }, Em.I18n.t('hosts.host.addComponent.' + componentName ));
+        break;
+      case 'HIVE_METASTORE':
+        this.set('hiveMetastoreHost',hiveHost);
+        this.loadConfigs("loadHiveConfigs");
+        break;
+      default:
+        if (this.get('securityEnabled') && componentName !== 'CLIENTS') {
+          returnFunc = App.showConfirmationPopup(function () {
+            self.primary(component);
+          }, Em.I18n.t('hosts.host.addComponent.securityNote').format(componentName, self.get('content.hostName')));
+        }
+        else {
+          returnFunc = this.addClientComponent(component);
+        }
     }
+    return returnFunc;
   },
   /**
    * Send command to server to install client on selected host
@@ -528,7 +545,7 @@ App.MainHostDetailsController = Em.Controller.extend({
    * @param {object} data
    * @param {object} opt
    * @param {object} params
-   * @method installNewComponentSuccessCallback
+   * @method installNewComponentSuccessCallbÆ’ack
    */
   installNewComponentSuccessCallback: function (data, opt, params) {
     if (!data.Requests || !data.Requests.id) {
@@ -542,7 +559,7 @@ App.MainHostDetailsController = Em.Controller.extend({
     }
 
     this.showBackgroundOperationsPopup(function () {
-      if (params.componentName === 'ZOOKEEPER_SERVER' || params.componentName === 'HIVE_METASTORE'
||  params.componentName === 'HIVE_SERVER') {
+      if (params.componentName === 'ZOOKEEPER_SERVER' || params.componentName === 'HIVE_SERVER')
{
         self.set(params.componentName === 'ZOOKEEPER_SERVER' ? 'zkRequestId' : 'hiveRequestId',
data.Requests.id);
         self.addObserver(
           'App.router.backgroundOperationsController.serviceTimestamp',
@@ -625,13 +642,15 @@ App.MainHostDetailsController = Em.Controller.extend({
    * @method onLoadHiveConfigs
    */
   onLoadHiveConfigs: function (data) {
-    var hiveMSHosts = this.getHiveHosts();
-    var hiveMasterHosts = hiveMSHosts.concat(App.HostComponent.find().filterProperty('componentName',
'HIVE_SERVER').mapProperty('hostName')).uniq().sort().join(',');
-    var configs = {};
-    var attributes = {};
-    var port = "";
-    var hiveUser = "";
-    var webhcatUser = "";
+    var
+      hiveMetastoreHost = this.get('hiveMetastoreHost'),
+      hiveMSHosts = this.getHiveHosts(),
+      hiveMasterHosts = hiveMSHosts.concat(App.HostComponent.find().filterProperty('componentName',
'HIVE_SERVER').mapProperty('hostName')).uniq().sort().join(','),
+      configs = {},
+      attributes = {},
+      port = "",
+      hiveUser = "",
+      webhcatUser = "";
 
     data.items.forEach(function (item) {
       configs[item.type] = item.properties;
@@ -673,18 +692,21 @@ App.MainHostDetailsController = Em.Controller.extend({
         }
       }
     ];
-    this.saveConfigsBatch(groups);
+    this.saveConfigsBatch(groups, hiveMetastoreHost);
   },
 
   /**
    * save configs' sites in batch
    * @param groups
    */
-  saveConfigsBatch: function (groups) {
+  saveConfigsBatch: function (groups, hiveMetastoreHost) {
     groups.forEach(function (group) {
-      var desiredConfigs = [];
-      var tag = 'version' + (new Date).getTime();
-      var properties = group.properties;
+      var
+        self = this,
+        desiredConfigs = [],
+        tag = 'version' + (new Date).getTime(),
+        properties = group.properties;
+
       for (var site in properties) {
         if (!properties.hasOwnProperty(site)) continue;
         desiredConfigs.push({
@@ -701,7 +723,9 @@ App.MainHostDetailsController = Em.Controller.extend({
           sender: this,
           data: {
             desired_config: desiredConfigs
-          }
+          },
+          defaultSuccessCallback: function () {},
+          success: !!hiveMetastoreHost ? componentsUtils.installHostComponent(hiveMetastoreHost,
App.StackServiceComponent.find("HIVE_METASTORE")) : this.defaultSuccessCallback
         });
       }
     }, this);
@@ -714,7 +738,15 @@ App.MainHostDetailsController = Em.Controller.extend({
   deleteHiveMetaStore: false,
 
   getHiveHosts: function () {
-    var hiveHosts = App.HostComponent.find().filterProperty('componentName', 'HIVE_METASTORE').mapProperty('hostName');
+    var
+      hiveHosts = App.HostComponent.find().filterProperty('componentName', 'HIVE_METASTORE').mapProperty('hostName'),
+      hiveMetastoreHost = this.get('hiveMetastoreHost');
+
+    if(!!hiveMetastoreHost){
+      hiveHosts.push(hiveMetastoreHost);
+      this.set('hiveMetastoreHost', '');
+    }
+
     if (this.get('fromDeleteHost') || this.get('deleteHiveMetaStore')) {
       this.set('deleteHiveMetaStore', false);
       this.set('fromDeleteHost', false);

http://git-wip-us.apache.org/repos/asf/ambari/blob/bff7124b/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index f6527ed..97e5a93 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -623,7 +623,16 @@ App.MainServiceItemController = Em.Controller.extend({
         var selectedHost = this.get('selectedHost');
 
         // Install
-        componentsUtils.installHostComponent(selectedHost, component);
+        if(component.get('componentName') == "HIVE_METASTORE" && !!selectedHost){
+          App.router.get('mainHostDetailsController').addComponent(
+            {
+              context: component,
+              hiveMetastoreHost: selectedHost
+            }
+          );
+        } else {
+          componentsUtils.installHostComponent(selectedHost, component);
+        }
 
         // Remove host from 'without' collection to immediate recalculate add menu item state
         var hostsWithoutComponent = this.get('hostsWithoutComponent');

http://git-wip-us.apache.org/repos/asf/ambari/blob/bff7124b/ambari-web/app/utils/components.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/components.js b/ambari-web/app/utils/components.js
index 7bb4ae3..6264895 100644
--- a/ambari-web/app/utils/components.js
+++ b/ambari-web/app/utils/components.js
@@ -19,9 +19,10 @@ var App = require('app');
 
 module.exports = {
   installHostComponent: function(hostName, component) {
-    var self = this;
-    var componentName = component.get('componentName');
-    var displayName = component.get('displayName');
+    var
+      self = this,
+      componentName = component.get('componentName'),
+      displayName = component.get('displayName');
     App.ajax.send({
       name: 'host.host_component.add_new_component',
       sender: self,


Mime
View raw message