Repository: ambari Updated Branches: refs/heads/branch-2.1 0f3b981c7 -> 3da54568a
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/3da54568 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3da54568 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3da54568 Branch: refs/heads/branch-2.1 Commit: 3da54568a4831e6b19e2a65733b152ac91acb450 Parents: 0f3b981 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Fri Nov 27 11:53:34 2015 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Fri Nov 27 11:53:34 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host/details.js | 87 +++++++++++--------- ambari-web/app/messages.js | 2 + .../main/host/details/deleteComponentPopup.hbs | 19 ++--- .../test/controllers/main/host/details_test.js | 60 ++++++++++++-- 4 files changed, 116 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/3da54568/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 34cf80d..d71a172 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -318,44 +318,29 @@ 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: function () { - return !this.get('isChecked'); - }.property('isChecked'), + + 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 () { @@ -437,6 +422,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'); @@ -606,6 +594,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); @@ -860,6 +854,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 = {}, @@ -908,7 +903,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); }, @@ -971,21 +970,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/3da54568/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index af3f156..1905385 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -2335,7 +2335,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/3da54568/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/3da54568/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 05574df..2229251 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -512,6 +512,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({ @@ -2663,7 +2672,8 @@ describe('App.MainHostDetailsController', function () { 'input': { 'hiveMetastoreHost': '', 'fromDeleteHost': false, - 'deleteHiveMetaStore': false + 'deleteHiveMetaStore': false, + 'deleteWebHCatServer': false }, 'hiveHosts': ['h1', 'h2'], 'title': 'adding HiveServer2' @@ -2672,17 +2682,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' @@ -2690,12 +2712,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' } ]; @@ -2712,6 +2757,10 @@ describe('App.MainHostDetailsController', function () { { componentName: 'HIVE_SERVER', hostName: 'h3' + }, + { + componentName: 'WEBHCAT_SERVER', + hostName: 'h4' } ]); }); @@ -2725,8 +2774,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; });