Repository: ambari Updated Branches: refs/heads/branch-1.6.1 b0adc2f6f -> d5e205377
AMBARI-6328. Add Service wizard: ATS should not be added in secure cluster. (jaimin) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d5e20537 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d5e20537 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d5e20537 Branch: refs/heads/branch-1.6.1 Commit: d5e205377015ae498975cf745e6f81852899071a Parents: b0adc2f Author: Jaimin Jetly <[email protected]> Authored: Tue Jul 1 13:27:43 2014 -0700 Committer: Jaimin Jetly <[email protected]> Committed: Tue Jul 1 13:27:57 2014 -0700 ---------------------------------------------------------------------- .../app/controllers/wizard/step5_controller.js | 27 ++++++--- .../app/controllers/wizard/step8_controller.js | 63 ++++++-------------- ambari-web/app/models/service_config.js | 25 +++++--- 3 files changed, 54 insertions(+), 61 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/d5e20537/ambari-web/app/controllers/wizard/step5_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step5_controller.js b/ambari-web/app/controllers/wizard/step5_controller.js index 5d1137f..6bcc467 100644 --- a/ambari-web/app/controllers/wizard/step5_controller.js +++ b/ambari-web/app/controllers/wizard/step5_controller.js @@ -152,7 +152,7 @@ App.WizardStep5Controller = Em.Controller.extend({ if (!hostObj) return; var masterServices = this.get("selectedServicesMasters").filterProperty("selectedHost", item), masterServicesToDisplay = []; - masterServices.mapProperty('display_name').uniq().forEach(function(n) { + masterServices.mapProperty('display_name').uniq().forEach(function (n) { masterServicesToDisplay.pushObject(masterServices.findProperty('display_name', n)); }); mappingObject = Em.Object.create({ @@ -167,14 +167,14 @@ App.WizardStep5Controller = Em.Controller.extend({ return mapping.sortProperty('host_name'); }.property("[email protected]", '[email protected]'), - + /** * Count of hosts without masters * @type {number} */ remainingHosts: function () { if (this.get('content.controllerName') === 'installerController') { - return 0; + return 0; } else { return (this.get("hosts.length") - this.get("masterHostMapping.length")); } @@ -256,7 +256,7 @@ App.WizardStep5Controller = Em.Controller.extend({ */ updateComponent: function (componentName) { var component = this.last(componentName); - if(!component) { + if (!component) { return; } var services = this.get('content.services').filterProperty('isInstalled', true).mapProperty('serviceName'); @@ -320,15 +320,24 @@ App.WizardStep5Controller = Em.Controller.extend({ loadComponents: function () { var services = this.get('content.services').filterProperty('isSelected', true).mapProperty('serviceName'); //list of shown services + var selectedServices = this.get('content.services').filterProperty('isSelected').filterProperty('isInstalled', false).mapProperty('serviceName'); var masterComponents = App.StackServiceComponent.find().filterProperty('isShownOnInstallerAssignMasterPage', true); //get full list from mock data var masterHosts = this.get('content.masterComponentHosts'); //saved to local storage info var resultComponents = []; - var servicesLength = services.length; - for (var index = 0; index < servicesLength; index++) { + for (var index = 0; index < services.length; index++) { var componentInfo = masterComponents.filterProperty('serviceName', services[index]); + // If service is already installed and not being added as a new service then render on UI only those master components + // that have already installed hostComponents. + // NOTE: On upgrade there might be a prior installed service with non-installed newly introduced serviceComponent + var isNotSelectedService = !selectedServices.contains(services[index]); + if (isNotSelectedService) { + componentInfo = componentInfo.filter(function (_component) { + return App.HostComponent.find().someProperty('componentName',_component.get('componentName')); + }); + } componentInfo.forEach(function (_componentInfo) { if (_componentInfo.get('componentName') == 'ZOOKEEPER_SERVER' || _componentInfo.get('componentName') == 'HBASE_MASTER') { @@ -381,7 +390,7 @@ App.WizardStep5Controller = Em.Controller.extend({ * @private * @method _isHiveCoHost */ - _isHiveCoHost: function(componentName) { + _isHiveCoHost: function (componentName) { return ['HIVE_METASTORE', 'WEBHCAT_SERVER'].contains(componentName) && !this.get('isReassignWizard'); }, @@ -582,13 +591,13 @@ App.WizardStep5Controller = Em.Controller.extend({ * @returns {boolean} true - valid, false - invalid * @method isHostNameValid */ - isHostNameValid: function(componentName, selectedHost) { + isHostNameValid: function (componentName, selectedHost) { return (selectedHost.trim() !== '') && this.get('hosts').mapProperty('host_name').contains(selectedHost) && (this.get('selectedServicesMasters'). filterProperty('component_name', componentName). mapProperty('selectedHost'). - filter(function(h) { + filter(function (h) { return h === selectedHost; }).length <= 1); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/d5e20537/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 2beff37..4c97e41 100644 --- a/ambari-web/app/controllers/wizard/step8_controller.js +++ b/ambari-web/app/controllers/wizard/step8_controller.js @@ -569,7 +569,7 @@ App.WizardStep8Controller = Em.Controller.extend({ if (['addHostController', 'addServiceController'].contains(this.get('content.controllerName'))) { this.loadRepoInfo(); } else { - // from install wizard + // from install wizard var selectedStack = this.get('content.stacks').findProperty('isSelected', true); var allRepos = []; if (selectedStack && selectedStack.operatingSystems) { @@ -655,7 +655,7 @@ App.WizardStep8Controller = Em.Controller.extend({ if (Em.isNone(serviceObj)) return; serviceObj.get('service_components').forEach(function (_component) { this.assignComponentHosts(_component); - console.log(' ---INFO: step8: service component: ' + _service.serviceName); + console.log(' ---INFO: step8: service component: ' + _service.serviceName); }, this); this.get('services').pushObject(serviceObj); }, this); @@ -673,7 +673,7 @@ App.WizardStep8Controller = Em.Controller.extend({ console.log(' --- ---INFO: step8: in customHandler'); } else { - console.log(' --- ---INFO: step8: NOT in customHandler'); + console.log(' --- ---INFO: step8: NOT in customHandler'); if (component.get('isMaster')) { console.log(' --- ---INFO: step8: component isMaster'); componentValue = this.get('content.masterComponentHosts') @@ -699,22 +699,22 @@ App.WizardStep8Controller = Em.Controller.extend({ loadHiveDbValue: function (dbComponent) { var db, serviceConfigPreoprties = this.get('wizardController').getDBProperty('serviceConfigProperties'), - hiveDb = serviceConfigPreoprties .findProperty('name', 'hive_database'); + hiveDb = serviceConfigPreoprties.findProperty('name', 'hive_database'); if (hiveDb.value === 'New MySQL Database') { dbComponent.set('component_value', 'MySQL (New Database)'); } else { if (hiveDb.value === 'Existing MySQL Database') { - db = serviceConfigPreoprties .findProperty('name', 'hive_existing_mysql_database'); + db = serviceConfigPreoprties.findProperty('name', 'hive_existing_mysql_database'); dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')'); } else { if (hiveDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql')) { - db = serviceConfigPreoprties .findProperty('name', 'hive_existing_postgresql_database'); + db = serviceConfigPreoprties.findProperty('name', 'hive_existing_postgresql_database'); dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')'); } else { // existing oracle database - db = serviceConfigPreoprties .findProperty('name', 'hive_existing_oracle_database'); + db = serviceConfigPreoprties.findProperty('name', 'hive_existing_oracle_database'); dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')'); } } @@ -1073,34 +1073,6 @@ App.WizardStep8Controller = Em.Controller.extend({ } }); }, this); - - if (this.get('content.controllerName') == 'addServiceController' && !App.get('testMode')) { - // Add service-components which show up in newer versions but did not - // exist in older ones. - var self = this; - var newServiceComponents = {}; - if (App.get('isHadoop21Stack')) { - if (App.YARNService.find().objectAt(0)) { - newServiceComponents['APP_TIMELINE_SERVER'] = 'YARN'; - } - } - for (var componentName in newServiceComponents) { - if (newServiceComponents.hasOwnProperty(componentName)) { - var serviceName = newServiceComponents[componentName]; - // Create only if it doesnt exist - App.ajax.send({ - name: 'service.service_component', - sender: self, - data: { - serviceName: serviceName, - componentName: componentName, - async: false - }, - error: 'newServiceComponentErrorCallback' - }); - } - } - } }, /** @@ -1164,9 +1136,12 @@ App.WizardStep8Controller = Em.Controller.extend({ * @method createMasterHostComponents */ createMasterHostComponents: function () { - var masterHosts = this.get('content.masterComponentHosts'); - masterHosts.mapProperty('component').uniq().forEach(function (component) { - var hostNames = masterHosts.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName'); + // create master components for only selected services. + var selectedMasterComponents = this.get('content.masterComponentHosts').filter(function (_component) { + return this.get('selectedServices').mapProperty('serviceName').contains(_component.serviceId) + }, this); + selectedMasterComponents.mapProperty('component').uniq().forEach(function (component) { + var hostNames = selectedMasterComponents.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName'); this.registerHostsToComponent(hostNames, component); }, this); }, @@ -1230,7 +1205,7 @@ App.WizardStep8Controller = Em.Controller.extend({ var installedHosts = this.get('content.hosts'); for (var hostName in installedHosts) { if (installedHosts[hostName].isInstalled && - installedHosts[hostName].hostComponents.filterProperty('HostRoles.state', 'INSTALLED').mapProperty('HostRoles.component_name').contains(_client.component_name)) { + installedHosts[hostName].hostComponents.filterProperty('HostRoles.state', 'INSTALLED').mapProperty('HostRoles.component_name').contains(_client.component_name)) { clientHosts.push(hostName); } } @@ -1250,10 +1225,10 @@ App.WizardStep8Controller = Em.Controller.extend({ * hostName: {String} * } * to content.additionalClients - * later it will be used to install client on host before istalling new services + * later it will be used to install client on host before installing new services */ if (this.get('content.controllerName') === 'addServiceController' && hostNames.length > 0) { - hostNames.forEach(function (hostName) { + hostNames.forEach(function (hostName) { this.get('content.additionalClients').push(Em.Object.create({ componentName: _client.component_name, hostName: hostName })) @@ -1599,7 +1574,7 @@ App.WizardStep8Controller = Em.Controller.extend({ createCoreSiteObj: function () { var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml'), coreSiteProperties = {}, - // some configs needs to be skipped if services are not selected + // some configs needs to be skipped if services are not selected isOozieSelected = this.get('selectedServices').someProperty('serviceName', 'OOZIE'), oozieUser = this.get('globals').someProperty('name', 'oozie_user') ? this.get('globals').findProperty('name', 'oozie_user').value : null, isHiveSelected = this.get('selectedServices').someProperty('serviceName', 'HIVE'), @@ -1619,8 +1594,8 @@ App.WizardStep8Controller = Em.Controller.extend({ // exclude some configs if service wasn't selected if ( (isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) && - (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) && - (isHcatSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) { + (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) && + (isHcatSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) { coreSiteProperties[_coreSiteObj.name] = App.config.escapeXMLCharacters(_coreSiteObj.value); } if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.default.name") { http://git-wip-us.apache.org/repos/asf/ambari/blob/d5e20537/ambari-web/app/models/service_config.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js index dfc480e..d405fe6 100644 --- a/ambari-web/app/models/service_config.js +++ b/ambari-web/app/models/service_config.js @@ -321,8 +321,11 @@ App.ServiceConfigProperty = Ember.Object.extend({ this.set('value', masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName); break; case 'ats_host': - if (!App.supports.appTimelineServer) return; // @todo remove test mode check after App Timeline service integration - this.set('value', masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER').hostName); + var atsHost = masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER'); + if (atsHost) + this.set('value', atsHost.hostName); + else + this.set('value', 'false'); break; case 'yarn.resourcemanager.hostname': var rmHost = masterComponentHostsInDB.findProperty('component', 'RESOURCEMANAGER').hostName; @@ -350,16 +353,22 @@ App.ServiceConfigProperty = Ember.Object.extend({ this.setDefaultValue("(\\w*)(?=:)",rmHost); break; case 'yarn.timeline-service.webapp.address': - var hsHost = masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER').hostName; - this.setDefaultValue("(0.0.0.0)(?=:)", hsHost); + var atsHost = masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER'); + if (atsHost) { + this.setDefaultValue("(0.0.0.0)(?=:)", atsHost.hostName); + } break; case 'yarn.timeline-service.webapp.https.address': - var hsHost = masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER').hostName; - this.setDefaultValue("(0.0.0.0)(?=:)", hsHost); + var atsHost = masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER'); + if (atsHost) { + this.setDefaultValue("(0.0.0.0)(?=:)", atsHost.hostName); + } break; case 'yarn.timeline-service.address': - var hsHost = masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER').hostName; - this.setDefaultValue("(0.0.0.0)(?=:)", hsHost); + var atsHost = masterComponentHostsInDB.findProperty('component', 'APP_TIMELINE_SERVER'); + if (atsHost) { + this.setDefaultValue("(0.0.0.0)(?=:)", atsHost.hostName); + } break; case 'nm_hosts': this.set('value', slaveComponentHostsInDB.findProperty('componentName', 'NODEMANAGER').hosts.mapProperty('hostName'));
