You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2015/12/01 19:19:54 UTC

[04/50] ambari git commit: AMBARI-14083. hadoop.proxyuser.hcat.hosts not updated when adding webhcat (onechiporenko)

AMBARI-14083. hadoop.proxyuser.hcat.hosts not updated when adding webhcat (onechiporenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 7312dbf1ef5f37c7c981dce40adbbf25d8efcbeb
Parents: b19bf6e
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Nov 27 11:53:34 2015 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Nov 27 11:58:47 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 81 ++++++++++++--------
 ambari-web/app/messages.js                      |  2 +
 .../main/host/details/deleteComponentPopup.hbs  | 19 +++--
 .../test/controllers/main/host/details_test.js  | 60 +++++++++++++--
 4 files changed, 113 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7312dbf1/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 2b7ae21..c3713fc 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -315,42 +315,27 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
       bodyClass: Em.View.extend({
         templateName: require('templates/main/host/details/deleteComponentPopup')
       }),
-      isHiveMetastore: function () {
-        return componentName == 'HIVE_METASTORE';
-      }.property(),
-      deleteHiveMetastoreMsg: Em.View.extend({
-        template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteHiveMetastore'))
-      }),
-      isNimbus: function () {
-        return componentName == 'NIMBUS';
-      }.property(),
-      deleteNimbusMsg: Em.View.extend({
-        template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteNimbus'))
-      }),
-      isRangerKMSServer: function () {
-        return componentName == 'RANGER_KMS_SERVER';
-      }.property(),
-      deleteRangerKMSServereMsg: Em.View.extend({
-        template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteRangerKMSServer'))
-      }),
+      isHiveMetastore: componentName == 'HIVE_METASTORE',
+      isWebHCatServer: componentName == 'WEBHCAT_SERVER',
+      isNimbus: componentName == 'NIMBUS',
+      isRangerKMSServer: componentName == 'RANGER_KMS_SERVER',
+      isZkServer: componentName == 'ZOOKEEPER_SERVER',
+
+      deleteHiveMetastoreMsg: Em.I18n.t('hosts.host.deleteComponent.popup.deleteHiveMetastore'),
+      deleteWebHCatServerMsg: Em.I18n.t('hosts.host.deleteComponent.popup.deleteWebHCatServer'),
+      deleteNimbusMsg: Em.I18n.t('hosts.host.deleteComponent.popup.deleteNimbus'),
+      deleteRangerKMSServereMsg: Em.I18n.t('hosts.host.deleteComponent.popup.deleteRangerKMSServer'),
+      lastComponentError: Em.I18n.t('hosts.host.deleteComponent.popup.warning').format(displayName),
+      deleteComponentMsg: Em.I18n.t('hosts.host.deleteComponent.popup.msg1').format(displayName),
+      deleteZkServerMsg: Em.I18n.t('hosts.host.deleteComponent.popup.deleteZooKeeperServer'),
+
       isChecked: false,
       disablePrimary: Em.computed.not('isChecked'),
       lastComponent: function () {
         this.set('isChecked', !isLastComponent);
         return isLastComponent;
       }.property(),
-      isZkServer: function () {
-        return componentName == 'ZOOKEEPER_SERVER';
-      }.property(),
-      lastComponentError: Em.View.extend({
-        template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.warning').format(displayName))
-      }),
-      deleteComponentMsg: function () {
-        return Em.I18n.t('hosts.host.deleteComponent.popup.msg1').format(displayName);
-      }.property(),
-      deleteZkServerMsg: Em.View.extend({
-        template: Em.Handlebars.compile(Em.I18n.t('hosts.host.deleteComponent.popup.deleteZooKeeperServer'))
-      }),
+
       onPrimary: function () {
         var popup = this;
         self._doDeleteHostComponent(component, function () {
@@ -431,6 +416,9 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
     } else if (data.componentName == 'HIVE_METASTORE') {
       this.set('deleteHiveMetaStore', true);
       this.loadConfigs('loadHiveConfigs');
+    } else if (data.componentName == 'WEBHCAT_SERVER') {
+      this.set('deleteWebHCatServer', true);
+      this.loadConfigs('loadHiveConfigs');
     } else if (data.componentName == 'HIVE_SERVER') {
       this.set('deleteHiveServer', true);
       this.loadConfigs('loadHiveConfigs');
@@ -586,6 +574,12 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
           self.loadConfigs("loadHiveConfigs");
         }, Em.I18n.t('hosts.host.addComponent.' + componentName) + manualKerberosWarning);
         break;
+      case 'WEBHCAT_SERVER':
+        returnFunc = App.showConfirmationPopup(function () {
+          self.set('webhcatServerHost', hostName);
+          self.loadConfigs("loadHiveConfigs");
+        }, Em.I18n.t('hosts.host.addComponent.' + componentName) + manualKerberosWarning);
+        break;
       case 'NIMBUS':
         returnFunc = App.showConfirmationPopup(function () {
           self.set('nimbusHost', hostName);
@@ -835,6 +829,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
   onLoadHiveConfigs: function (data) {
     var
       hiveMetastoreHost = this.get('hiveMetastoreHost'),
+      webhcatServerHost = this.get('webhcatServerHost'),
       hiveMSHosts = this.getHiveHosts(),
       hiveMasterHosts = hiveMSHosts.concat(App.HostComponent.find().filterProperty('componentName', 'HIVE_SERVER').mapProperty('hostName')).uniq().sort().join(','),
       configs = {},
@@ -883,7 +878,11 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
         }
       }
     ];
-    this.saveConfigsBatch(groups, this.get('addHiveServer') ? 'HIVE_SERVER' : 'HIVE_METASTORE', hiveMetastoreHost);
+    var params = [groups];
+    var componentName = this.get('addHiveServer') ? 'HIVE_SERVER' : (hiveMetastoreHost ? 'HIVE_METASTORE' : 'WEBHCAT_SERVER');
+    var host = webhcatServerHost || hiveMetastoreHost;
+    params.pushObjects([componentName, host]);
+    this.saveConfigsBatch.apply(this, params);
     this.set('addHiveServer', false);
   },
 
@@ -946,21 +945,35 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
    */
   deleteHiveMetaStore: false,
 
+  /**
+   * Delete WebHCat Server is performed
+   *
+   * @type {bool}
+   */
+  deleteWebHCatServer: false,
+
   getHiveHosts: function () {
     var
       hiveHosts = App.HostComponent.find().filterProperty('componentName', 'HIVE_METASTORE').mapProperty('hostName'),
-      hiveMetastoreHost = this.get('hiveMetastoreHost');
+      hiveMetastoreHost = this.get('hiveMetastoreHost'),
+      webhcatServerHost = this.get('webhcatServerHost');
 
     if (!!hiveMetastoreHost) {
       hiveHosts.push(hiveMetastoreHost);
       this.set('hiveMetastoreHost', '');
     }
 
-    if (this.get('fromDeleteHost') || this.get('deleteHiveMetaStore') || this.get('deleteHiveServer')) {
+    if (!!webhcatServerHost) {
+      hiveHosts.push(webhcatServerHost);
+      this.set('webhcatServerHost' ,'');
+    }
+
+    if (this.get('fromDeleteHost') || this.get('deleteHiveMetaStore') || this.get('deleteHiveServer') || this.get('deleteWebHCatServer')) {
       this.set('deleteHiveMetaStore', false);
       this.set('deleteHiveServer', false);
+      this.set('deleteWebHCatServer', false);
       this.set('fromDeleteHost', false);
-      return hiveHosts.without(this.get('content.hostName'));
+      hiveHosts = hiveHosts.without(this.get('content.hostName'));
     }
     return hiveHosts.sort();
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/7312dbf1/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 7c7ca57..502a7a2 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -2321,7 +2321,9 @@ Em.I18n.translations = {
   'hosts.host.decommissioned':'Decommissioned',
   'hosts.host.decommissioning':'Decommissioning',
   'hosts.host.addComponent.HIVE_METASTORE':'Adding <i>Hive Metastore</i> will reconfigure such properties:<ul><li>hive.metastore.uris</li><li>templeton.hive.properties</li></ul>',
+  'hosts.host.addComponent.WEBHCAT_SERVER':'Adding <i>WebHCat Server</i> will reconfigure such properties:<ul><li>hive.metastore.uris</li><li>templeton.hive.properties</li></ul>',
   'hosts.host.deleteComponent.popup.deleteHiveMetastore':'Deleting <i>Hive Metastore</i> will reconfigure such properties:<ul><li>hive.metastore.uris</li><li>templeton.hive.properties</li></ul>',
+  'hosts.host.deleteComponent.popup.deleteWebHCatServer':'Deleting <i>WebHCat Server</i> will reconfigure such properties:<ul><li>hive.metastore.uris</li><li>templeton.hive.properties</li></ul>',
   'hosts.host.configs.save.note': 'This configuration is created by ambari while installing/deleting {0} component on a host',
 
   'hosts.component.passive.implied.host.mode.tooltip':'Cannot Turn Off Maintenance Mode because Host is in Maintenance Mode',

http://git-wip-us.apache.org/repos/asf/ambari/blob/7312dbf1/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs b/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
index d157aa9..4fd5c52 100644
--- a/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
+++ b/ambari-web/app/templates/main/host/details/deleteComponentPopup.hbs
@@ -16,26 +16,25 @@
 * limitations under the License.
 }}
 
-{{deleteComponentMsg}}<br/><br/>
+<p>{{{deleteComponentMsg}}}</p>
 {{#if lastComponent}}
   <div class="alert-error row-fluid">
     <div class='tinyspan tinyoffset'>{{view Ember.Checkbox checkedBinding="isChecked"}}</div>
-    <div class='span10'>{{view lastComponentError}}</div>
+    <div class='span10'>{{{lastComponentError}}}</div>
   </div>
 {{/if}}
 {{#if isZkServer}}
-  <br/>
-  <div class='alert'>{{view deleteZkServerMsg}}</div>
+  <div class='alert'>{{{deleteZkServerMsg}}}</div>
 {{/if}}
 {{#if isHiveMetastore}}
-  <br/>
-  <div class='alert'>{{view deleteHiveMetastoreMsg}}</div>
+  <div class='alert'>{{{deleteHiveMetastoreMsg}}}</div>
+{{/if}}
+{{#if isWebHCatServer}}
+  <div class='alert'>{{{deleteWebHCatServerMsg}}}</div>
 {{/if}}
 {{#if isNimbus}}
-  <br/>
-  <div class='alert'>{{view deleteNimbusMsg}}</div>
+  <div class='alert'>{{{deleteNimbusMsg}}}</div>
 {{/if}}
 {{#if isRangerKMSServer}}
-  <br/>
-  <div class='alert'>{{view deleteRangerKMSServereMsg}}</div>
+  <div class='alert'>{{{deleteRangerKMSServereMsg}}}</div>
 {{/if}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7312dbf1/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 64d5c79..f0a2874 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -526,6 +526,15 @@ describe('App.MainHostDetailsController', function () {
       controller.addComponent(event);
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
     });
+    it('add WEBHCAT_SERVER', function () {
+      var event = {
+        context: Em.Object.create({
+          componentName: 'WEBHCAT_SERVER'
+        })
+      };
+      controller.addComponent(event);
+      expect(App.showConfirmationPopup.calledOnce).to.be.true;
+    });
     it('add slave component', function () {
       var event = {
         context: Em.Object.create({
@@ -2969,7 +2978,8 @@ describe('App.MainHostDetailsController', function () {
         'input': {
           'hiveMetastoreHost': '',
           'fromDeleteHost': false,
-          'deleteHiveMetaStore': false
+          'deleteHiveMetaStore': false,
+          'deleteWebHCatServer': false
         },
         'hiveHosts': ['h1', 'h2'],
         'title': 'adding HiveServer2'
@@ -2978,17 +2988,29 @@ describe('App.MainHostDetailsController', function () {
         'input': {
           'hiveMetastoreHost': 'h0',
           'fromDeleteHost': false,
-          'deleteHiveMetaStore': false
+          'deleteHiveMetaStore': false,
+          'deleteWebHCatServer': false
         },
         'hiveHosts': ['h0', 'h1', 'h2'],
         'title': 'adding Hive Metastore'
       },
       {
         'input': {
+          'webhcatServerHost': 'h0',
+          'fromDeleteHost': false,
+          'deleteHiveMetaStore': false,
+          'deleteWebHCatServer': false
+        },
+        'hiveHosts': ['h0', 'h1', 'h2'],
+        'title': 'adding WebHCat Server'
+      },
+      {
+        'input': {
           'hiveMetastoreHost': '',
           'content.hostName': 'h1',
           'fromDeleteHost': false,
-          'deleteHiveMetaStore': true
+          'deleteHiveMetaStore': true,
+          'deleteWebHCatServer': false
         },
         'hiveHosts': ['h2'],
         'title': 'deleting Hive component'
@@ -2996,12 +3018,35 @@ describe('App.MainHostDetailsController', function () {
       {
         'input': {
           'hiveMetastoreHost': '',
+          'content.hostName': 'h4',
+          'fromDeleteHost': false,
+          'deleteHiveMetaStore': false,
+          'deleteWebHCatServer': true
+        },
+        'hiveHosts': ['h1', 'h2'],
+        'title': 'deleting WebHCat Server'
+      },
+      {
+        'input': {
+          'hiveMetastoreHost': '',
           'content.hostName': 'h2',
           'fromDeleteHost': true,
-          'deleteHiveMetaStore': false
+          'deleteHiveMetaStore': false,
+          'deleteWebHCatServer': false
         },
         'hiveHosts': ['h1'],
         'title': 'deleting host with Hive component'
+      },
+      {
+        'input': {
+          'webhcatServerHost': '',
+          'content.hostName': 'h2',
+          'fromDeleteHost': true,
+          'deleteHiveMetaStore': false,
+          'deleteWebHCatServer': false
+        },
+        'hiveHosts': ['h1'],
+        'title': 'deleting host with WebHCat Server'
       }
     ];
 
@@ -3018,6 +3063,10 @@ describe('App.MainHostDetailsController', function () {
         {
           componentName: 'HIVE_SERVER',
           hostName: 'h3'
+        },
+        {
+          componentName: 'WEBHCAT_SERVER',
+          hostName: 'h4'
         }
       ]);
     });
@@ -3031,8 +3080,9 @@ describe('App.MainHostDetailsController', function () {
         Em.keys(item.input).forEach(function (key) {
           controller.set(key, item.input[key]);
         });
-        expect(controller.getHiveHosts()).to.eql(item.hiveHosts);
+        expect(controller.getHiveHosts().toArray()).to.eql(item.hiveHosts);
         expect(controller.get('hiveMetastoreHost')).to.be.empty;
+        expect(controller.get('webhcatServerHost')).to.be.empty;
         expect(controller.get('fromDeleteHost')).to.be.false;
         expect(controller.get('deleteHiveMetaStore')).to.be.false;
       });