AMBARI-19572 Move Master and HA wizards for all components should show config changes that will be done as part of the wizard. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cba69d93 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cba69d93 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cba69d93 Branch: refs/heads/branch-dev-patch-upgrade Commit: cba69d93c0e062b37d89b75db00a16e0fa4369e2 Parents: b7d8f5e Author: ababiichuk <[email protected]> Authored: Mon Jan 16 18:54:21 2017 +0200 Committer: ababiichuk <[email protected]> Committed: Tue Jan 17 12:19:40 2017 +0200 ---------------------------------------------------------------------- .../main/service/reassign/step1_controller.js | 78 ++- .../main/service/reassign/step3_controller.js | 663 +++++++++++++++++++ .../main/service/reassign/step4_controller.js | 629 ++---------------- .../main/service/reassign_controller.js | 47 +- ambari-web/app/messages.js | 21 +- ambari-web/app/routes/reassign_master_routes.js | 24 +- ambari-web/app/styles/wizard.less | 2 +- .../highAvailability/journalNode/step2.hbs | 65 +- .../templates/main/service/reassign/step3.hbs | 36 +- .../views/main/service/reassign/step3_view.js | 4 +- .../views/main/service/reassign/step5_view.js | 4 +- .../service/reassign/step1_controller_test.js | 17 +- .../service/reassign/step3_controller_test.js | 634 ++++++++++++++++++ .../service/reassign/step4_controller_test.js | 646 +----------------- 14 files changed, 1582 insertions(+), 1288 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/controllers/main/service/reassign/step1_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step1_controller.js b/ambari-web/app/controllers/main/service/reassign/step1_controller.js index 9f30bb7..c631e85 100644 --- a/ambari-web/app/controllers/main/service/reassign/step1_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step1_controller.js @@ -26,9 +26,18 @@ App.ReassignMasterWizardStep1Controller = Em.Controller.extend({ * @type {object} */ dbPropertyMap: { - 'HIVE_SERVER': 'javax.jdo.option.ConnectionDriverName', - 'HIVE_METASTORE': 'javax.jdo.option.ConnectionDriverName', - 'OOZIE_SERVER': 'oozie.service.JPAService.jdbc.driver' + 'HIVE_SERVER': { + type: 'hive-site', + name: 'javax.jdo.option.ConnectionDriverName' + }, + 'HIVE_METASTORE': { + type: 'hive-site', + name: 'javax.jdo.option.ConnectionDriverName' + }, + 'OOZIE_SERVER': { + type: 'oozie-site', + name: 'oozie.service.JPAService.jdbc.driver' + } }, loadConfigsTags: function () { @@ -79,55 +88,78 @@ App.ReassignMasterWizardStep1Controller = Em.Controller.extend({ }, onLoadConfigs: function (data) { - var databaseProperty = null, - databaseType = null, - properties = {}, - isRemoteDB = null; + var databaseProperty, + databaseType = null, + databaseTypeMatch, + properties = {}, + configs = {}, + dbPropertyMapItem = Em.getWithDefault(this.get('dbPropertyMap'), this.get('content.reassign.component_name'), null), + serviceDbProp = this.get('content.reassign.service_id').toLowerCase() + '_database'; data.items.forEach(function(item) { - $.extend(properties, item.properties); + configs[item.type] = item.properties; }); - this.set('content.serviceProperties', properties); + this.get('content').setProperties({ + serviceProperties: properties, + configs: configs + }); - databaseProperty = properties[ Em.getWithDefault(this.get('dbPropertyMap'), this.get('content.reassign.component_name'), null) ]; - databaseType = databaseProperty.match(/MySQL|PostgreS|Oracle|Derby|MSSQL|Anywhere/gi)[0]; + if (dbPropertyMapItem) { + databaseProperty = Em.getWithDefault(configs, dbPropertyMapItem.type, {})[dbPropertyMapItem.name]; + databaseTypeMatch = databaseProperty && databaseProperty.match(/MySQL|PostgreS|Oracle|Derby|MSSQL|Anywhere/gi); + if (databaseTypeMatch) { + databaseType = databaseTypeMatch[0]; + } + } this.set('databaseType', databaseType); if (this.get('content.reassign.component_name') == 'OOZIE_SERVER' && databaseType !== 'derby') { App.router.reassignMasterController.set('content.hasManualSteps', false); } - var serviceDbProp = this.get('content.reassign.service_id').toLowerCase() + "_database"; - properties['is_remote_db'] = /Existing/ig.test( properties[serviceDbProp] ); + properties['is_remote_db'] = /Existing/ig.test(properties[serviceDbProp]); properties['database_hostname'] = this.getDatabaseHost(); this.saveDatabaseType(databaseType); this.saveServiceProperties(properties); + this.saveConfigs(configs); }, saveDatabaseType: function(type) { - if(type) { + if (type) { App.router.get(this.get('content.controllerName')).saveDatabaseType(type); } }, saveServiceProperties: function(properties) { - if(properties) { + if (properties) { App.router.get(this.get('content.controllerName')).saveServiceProperties(properties); } }, + saveConfigs: function(configs) { + if (configs) { + App.router.get(this.get('content.controllerName')).saveConfigs(configs); + } + }, + getDatabaseHost: function() { - var db_type = this.get('databaseType'); - var connectionURLPRops = { - 'HIVE': 'javax.jdo.option.ConnectionURL', - 'OOZIE': 'oozie.service.JPAService.jdbc.url' - }; - - var service = this.get('content.reassign.service_id'); - var connectionURL = this.get('content.serviceProperties')[connectionURLPRops[service]]; + var db_type = this.get('databaseType'), + connectionURLProps = { + 'HIVE': { + type: 'hive-site', + name: 'javax.jdo.option.ConnectionURL' + }, + 'OOZIE': { + type: 'oozie-site', + name: 'oozie.service.JPAService.jdbc.url' + } + }, + service = this.get('content.reassign.service_id'), + connectionURLPropsItem = connectionURLProps[service], + connectionURL = Em.getWithDefault(this.get('content.configs'), connectionURLPropsItem.type, {})[connectionURLPropsItem.name]; connectionURL = connectionURL.replace("jdbc:" + db_type + "://", ""); connectionURL = connectionURL.replace("/hive?createDatabaseIfNotExist=true", ""); http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/controllers/main/service/reassign/step3_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step3_controller.js b/ambari-web/app/controllers/main/service/reassign/step3_controller.js index d717dea..f13cf0b 100644 --- a/ambari-web/app/controllers/main/service/reassign/step3_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step3_controller.js @@ -21,6 +21,669 @@ var App = require('app'); App.ReassignMasterWizardStep3Controller = Em.Controller.extend({ name: 'reassignMasterWizardStep3Controller', + componentSpecificTypesMap: { + 'NAMENODE': [ + { + serviceName: 'HBASE', + configTypes: ['hbase-site'] + }, + { + serviceName: 'ACCUMULO', + configTypes: ['accumulo-site'] + }, + { + serviceName: 'HAWQ', + configTypes: ['hawq-site', 'hdfs-client'] + } + ], + 'RESOURCEMANAGER': [ + { + serviceName: 'HAWQ', + configTypes: ['hawq-site', 'yarn-client'] + } + ] + }, + + /** + * additional configs with template values + * Part of value to substitute has following format: "<replace-value>" + */ + additionalConfigsMap: [ + { + componentName: 'RESOURCEMANAGER', + configs: { + 'yarn-site': { + 'yarn.resourcemanager.address': '<replace-value>:8050', + 'yarn.resourcemanager.admin.address': '<replace-value>:8141', + 'yarn.resourcemanager.resource-tracker.address': '<replace-value>:8025', + 'yarn.resourcemanager.scheduler.address': '<replace-value>:8030', + 'yarn.resourcemanager.webapp.address': '<replace-value>:8088', + 'yarn.resourcemanager.hostname': '<replace-value>' + } + } + }, + { + componentName: 'JOBTRACKER', + configs: { + 'mapred-site': { + 'mapred.job.tracker.http.address': '<replace-value>:50030', + 'mapred.job.tracker': '<replace-value>:50300' + } + } + }, + { + componentName: 'SECONDARY_NAMENODE', + configs: { + 'hdfs-site': { + 'dfs.secondary.http.address': '<replace-value>:50090' + } + }, + configs_Hadoop2: { + 'hdfs-site': { + 'dfs.namenode.secondary.http-address': '<replace-value>:50090' + } + } + }, + { + componentName: 'NAMENODE', + configs: { + 'hdfs-site': { + 'dfs.http.address': '<replace-value>:50070', + 'dfs.https.address': '<replace-value>:50470' + }, + 'core-site': { + 'fs.default.name': 'hdfs://<replace-value>:8020' + } + }, + configs_Hadoop2: { + 'hdfs-site': { + 'dfs.namenode.rpc-address': '<replace-value>:8020', + 'dfs.namenode.http-address': '<replace-value>:50070', + 'dfs.namenode.https-address': '<replace-value>:50470' + }, + 'core-site': { + 'fs.defaultFS': 'hdfs://<replace-value>:8020' + } + } + }, + { + componentName: 'APP_TIMELINE_SERVER', + configs: { + 'yarn-site': { + 'yarn.timeline-service.webapp.address': '<replace-value>:8188', + 'yarn.timeline-service.webapp.https.address': '<replace-value>:8190', + 'yarn.timeline-service.address': '<replace-value>:10200' + } + } + }, + { + componentName: 'OOZIE_SERVER', + configs: { + 'oozie-site': { + 'oozie.base.url': 'http://<replace-value>:11000/oozie' + }, + 'core-site': { + 'hadoop.proxyuser.oozie.hosts': '<replace-value>' + } + } + }, + { + componentName: 'HIVE_METASTORE', + configs: { + 'hive-site': {} + } + }, + { + componentName: 'MYSQL_SERVER', + configs: { + 'hive-site': { + 'javax.jdo.option.ConnectionURL': 'jdbc:mysql://<replace-value>/hive?createDatabaseIfNotExist=true' + } + } + }, + { + componentName: 'HISTORYSERVER', + configs: { + 'mapred-site': { + 'mapreduce.jobhistory.webapp.address': '<replace-value>:19888', + 'mapreduce.jobhistory.address': '<replace-value>:10020' + } + } + } + ], + + secureConfigsMap: [ + { + componentName: 'NAMENODE', + configs: [ + { + site: 'hdfs-site', + keytab: 'dfs.namenode.keytab.file', + principal: 'dfs.namenode.kerberos.principal' + }, + { + site: 'hdfs-site', + keytab: 'dfs.web.authentication.kerberos.keytab', + principal: 'dfs.web.authentication.kerberos.principal' + } + ] + }, + { + componentName: 'SECONDARY_NAMENODE', + configs: [ + { + site: 'hdfs-site', + keytab: 'dfs.secondary.namenode.keytab.file', + principal: 'dfs.secondary.namenode.kerberos.principal' + }, + { + site: 'hdfs-site', + keytab: 'dfs.web.authentication.kerberos.keytab', + principal: 'dfs.web.authentication.kerberos.principal' + } + ] + }, + { + componentName: 'RESOURCEMANAGER', + configs: [ + { + site: 'yarn-site', + keytab: 'yarn.resourcemanager.keytab', + principal: 'yarn.resourcemanager.principal' + }, + { + site: 'yarn-site', + keytab: 'yarn.resourcemanager.webapp.spnego-keytab-file', + principal: 'yarn.resourcemanager.webapp.spnego-principal' + } + ] + }, + { + componentName: 'OOZIE_SERVER', + configs: [ + { + site: 'oozie-site', + keytab: 'oozie.authentication.kerberos.keytab', + principal: 'oozie.authentication.kerberos.principal' + }, + { + site: 'oozie-site', + keytab: 'oozie.service.HadoopAccessorService.keytab.file', + principal: 'oozie.service.HadoopAccessorService.kerberos.principal' + } + ] + }, + { + componentName: 'WEBHCAT_SERVER', + configs: [ + { + site: 'webhcat-site', + keytab: 'templeton.kerberos.keytab', + principal: 'templeton.kerberos.principal' + } + ] + }, + { + componentName: 'HIVE_SERVER', + configs: [ + { + site: 'hive-site', + keytab: 'hive.server2.authentication.kerberos.keytab', + principal: 'hive.server2.authentication.kerberos.principal' + }, + { + site: 'hive-site', + keytab: 'hive.server2.authentication.spnego.keytab', + principal: 'hive.server2.authentication.spnego.principal' + } + ] + }, + { + componentName: 'HIVE_METASTORE', + configs: [ + { + site: 'hive-site', + keytab: 'hive.metastore.kerberos.keytab.file', + principal: 'hive.metastore.kerberos.principal' + } + ] + } + + ], + + isLoaded: false, + + versionLoaded: true, + + hideDependenciesInfoBar: true, + + configs: null, + + secureConfigs: [], + + stepConfigs: [], + + propertiesToChange: {}, + + isSubmitDisabled: Em.computed.and('wizardController.isComponentWithReconfiguration', '!isLoaded'), + + loadStep: function () { + if (this.get('wizardController.isComponentWithReconfiguration')) { + this.set('isLoaded', false); + App.ajax.send({ + name: 'config.tags', + sender: this, + success: 'onLoadConfigsTags' + }); + } + }, + + clearStep: function () { + this.setProperties({ + configs: null, + secureConfigs: [], + propertiesToChange: {} + }); + }, + + onLoadConfigsTags: function (data) { + var urlParams = this.getConfigUrlParams(this.get('content.reassign.component_name'), data); + + App.ajax.send({ + name: 'reassign.load_configs', + sender: this, + data: { + urlParams: urlParams.join('|') + }, + success: 'onLoadConfigs' + }); + }, + + getConfigUrlParams: function (componentName, data) { + var urlParams = []; + + this.get('wizardController.serviceToConfigSiteMap')[componentName].forEach(function(site){ + urlParams.push('(type=' + site + '&tag=' + data.Clusters.desired_configs[site].tag + ')'); + }); + + // specific cases for certain components + var specificTypes = this.get('componentSpecificTypesMap')[componentName]; + if (specificTypes) { + var services = App.Service.find(); + specificTypes.forEach(function (service) { + if (services.someProperty('serviceName', service.serviceName)) { + service.configTypes.forEach(function (site) { + urlParams.push('(type=' + site + '&tag=' + data.Clusters.desired_configs[site].tag + ')'); + }); + } + }); + } + + return urlParams; + }, + + renderServiceConfigs: function (configs) { + var self = this, + configCategories = [], + displayedConfigs = [], + serviceConfig = App.ServiceConfig.create({ + serviceName: 'MISC', + configCategories: configCategories, + showConfig: true, + configs: displayedConfigs + }); + App.get('router.mainController.isLoading').call(App.get('router.clusterController'), 'isConfigsPropertiesLoaded').done(function () { + Em.keys(self.get('propertiesToChange')).forEach(function (type) { + var service = App.config.get('serviceByConfigTypeMap')[type]; + if (service) { + var serviceName = service.get('serviceName'); + if (!configCategories.someProperty('name', serviceName)) { + configCategories.push(App.ServiceConfigCategory.create({ + name: serviceName, + displayName: service.get('displayName') + })); + } + this.get('propertiesToChange')[type].forEach(function (property) { + var propertyName = property.name, + stackProperty = App.configsCollection.getConfigByName(propertyName, type) || {}, + displayedProperty = App.ServiceConfigProperty.create({ + name: propertyName, + displayName: propertyName, + fileName: type + }, stackProperty, { + value: configs[type][propertyName], + category: serviceName, + isEditable: Boolean(stackProperty.isEditable !== false && !property.isSecure) + }); + displayedConfigs.push(displayedProperty); + }); + } + }, self); + self.setProperties({ + stepConfigs: [serviceConfig], + selectedService: serviceConfig, + isLoaded: true + }); + }); + }, + + onLoadConfigs: function (data) { + // Find hawq-site.xml location + var hawqSiteIndex = -1; + for(var i = 0; i < data.items.length; i++){ + if(data.items[i].type == 'hawq-site'){ + hawqSiteIndex = i; + break; + } + } + + // if certain services are deployed, include related site files to additionalConfigsMap and relatedServicesMap. + if(hawqSiteIndex >= 0){ // if HAWQ is deployed + var hawqSiteProperties = { + 'hawq_rm_yarn_address': '<replace-value>:8050', + 'hawq_rm_yarn_scheduler_address': '<replace-value>:8030' + } + + var rmComponent = this.get('additionalConfigsMap').findProperty('componentName', "RESOURCEMANAGER"); + rmComponent.configs["hawq-site"] = hawqSiteProperties; + + if(data.items[hawqSiteIndex].properties["hawq_global_rm_type"].toLowerCase() === "yarn"){ + this.get('wizardController.relatedServicesMap')['RESOURCEMANAGER'].append('HAWQ'); + } + + } + + var componentName = this.get('content.reassign.component_name'); + var targetHostName = this.get('content.reassignHosts.target'); + var configs = {}; + var secureConfigs = []; + + data.items.forEach(function (item) { + configs[item.type] = item.properties; + }); + + this.setAdditionalConfigs(configs, componentName, targetHostName); + this.setSecureConfigs(secureConfigs, configs, componentName); + + this.set('secureConfigs', secureConfigs); + + switch (componentName) { + case 'NAMENODE': + App.MoveNameNodeConfigInitializer.setup(this._getNnInitializerSettings(configs)); + configs = this.setDynamicConfigs(configs, App.MoveNameNodeConfigInitializer); + App.MoveNameNodeConfigInitializer.cleanup(); + break; + case 'RESOURCEMANAGER': + App.MoveRmConfigInitializer.setup(this._getRmInitializerSettings(configs)); + var additionalDependencies = this._getRmAdditionalDependencies(configs); + configs = this.setDynamicConfigs(configs, App.MoveRmConfigInitializer, additionalDependencies); + App.MoveRmConfigInitializer.cleanup(); + break; + case 'HIVE_METASTORE': + App.MoveHmConfigInitializer.setup(this._getHiveInitializerSettings(configs)); + configs = this.setDynamicConfigs(configs, App.MoveHmConfigInitializer); + App.MoveHmConfigInitializer.cleanup(); + break; + case 'HIVE_SERVER': + App.MoveHsConfigInitializer.setup(this._getHiveInitializerSettings(configs)); + configs = this.setDynamicConfigs(configs, App.MoveHsConfigInitializer); + App.MoveHsConfigInitializer.cleanup(); + break; + case 'WEBHCAT_SERVER': + App.MoveWsConfigInitializer.setup(this._getWsInitializerSettings(configs)); + configs = this.setDynamicConfigs(configs, App.MoveWsConfigInitializer); + App.MoveWsConfigInitializer.cleanup(); + break; + case 'OOZIE_SERVER': + App.MoveOSConfigInitializer.setup(this._getOsInitializerSettings(configs)); + configs = this.setDynamicConfigs(configs, App.MoveOSConfigInitializer); + App.MoveOSConfigInitializer.cleanup(); + } + + this.renderServiceConfigs(configs); + this.set('configs', configs); + }, + + /** + * set additional configs + * configs_Hadoop2 - configs which belongs to Hadoop 2 stack only + * @param configs + * @param componentName + * @param replaceValue + * @return {Boolean} + */ + setAdditionalConfigs: function (configs, componentName, replaceValue) { + var component = this.get('additionalConfigsMap').findProperty('componentName', componentName); + + if (Em.isNone(component)) return false; + var additionalConfigs = (component.configs_Hadoop2) ? component.configs_Hadoop2 : component.configs; + + for (var site in additionalConfigs) { + if (additionalConfigs.hasOwnProperty(site)) { + for (var property in additionalConfigs[site]) { + if (additionalConfigs[site].hasOwnProperty(property)) { + if (App.get('isHaEnabled') && componentName === 'NAMENODE' && (property === 'fs.defaultFS' || property === 'dfs.namenode.rpc-address')) continue; + + configs[site][property] = additionalConfigs[site][property].replace('<replace-value>', replaceValue); + if (!this.get('propertiesToChange').hasOwnProperty(site)) { + this.get('propertiesToChange')[site] = []; + } + this.get('propertiesToChange')[site].push({ + name: property + }); + } + } + } + } + return true; + }, + + /** + * set secure configs for component + * @param secureConfigs + * @param configs + * @param componentName + * @return {Boolean} + */ + setSecureConfigs: function (secureConfigs, configs, componentName) { + var securityEnabled = App.get('isKerberosEnabled'); + var component = this.get('secureConfigsMap').findProperty('componentName', componentName); + if (Em.isNone(component) || !securityEnabled) return false; + + component.configs.forEach(function (config) { + secureConfigs.push({ + keytab: configs[config.site][config.keytab], + principal: configs[config.site][config.principal] + }); + if (!this.get('propertiesToChange').hasOwnProperty(config.site)) { + this.get('propertiesToChange')[config.site] = []; + } + this.get('propertiesToChange')[config.site].push( + { + name: config.keytab, + isSecure: true + }, + { + name: config.principal, + isSecure: true + } + ); + }, this); + return true; + }, + + /** + * Get additional dependencies-data for App.MoveNameNodeConfigInitializer + * + * @param {object} configs + * @returns {object} + * @private + * @method _getNnInitializerSettings + */ + _getNnInitializerSettings: function (configs) { + var ret = {}; + if (App.get('isHaEnabled')) { + ret.namespaceId = configs['hdfs-site']['dfs.nameservices']; + ret.suffix = (configs['hdfs-site']['dfs.namenode.http-address.' + ret.namespaceId + '.nn1'].indexOf(this.get('content.reassignHosts.source')) != -1) ? 'nn1' : 'nn2'; + } + return ret; + }, + + /** + * Settings used to the App.MoveRmConfigInitializer setup + * + * @param {object} configs + * @returns {{suffix: string}} + * @private + * @method _getRmInitializerSettings + */ + _getRmInitializerSettings: function (configs) { + return { + suffix: configs['yarn-site']['yarn.resourcemanager.hostname.rm1'] === this.get('content.reassignHosts.source') ? 'rm1': 'rm2' + }; + }, + + /** + * Get additional dependencies-data for App.MoveRmConfigInitializer + * + * @param {object} configs + * @returns {object} + * @private + * @method _getRmAdditionalDependencies + */ + _getRmAdditionalDependencies: function (configs) { + var ret = {}; + var rm1 = configs['yarn-site']['yarn.resourcemanager.hostname.rm1']; + if (rm1) { + ret.rm1 = rm1; + } + var rm2 = configs['yarn-site']['yarn.resourcemanager.hostname.rm2']; + if (rm2) { + ret.rm2 = rm2; + } + return ret; + }, + + /** + * Settings used to the App.MoveHsConfigInitializer and App.MoveHmConfigInitializer setup + * + * @param {object} configs + * @returns {{hiveUser: string}} + * @private + * @method _getHiveInitializerSettings + */ + _getHiveInitializerSettings: function (configs) { + return { + hiveUser: configs['hive-env']['hive_user'] + }; + }, + + /** + * Settings used to the App.MoveWsConfigInitializer setup + * + * @param {object} configs + * @returns {{webhcatUser: string}} + * @private + * @method _getWsInitializerSettings + */ + _getWsInitializerSettings: function (configs) { + return { + webhcatUser: configs['hive-env']['webhcat_user'] + }; + }, + + /** + * Settings used to the App.MoveOSConfigInitializer setup + * + * @param {object} configs + * @returns {object} + * @private + * @method _getOsInitializerSettings + */ + _getOsInitializerSettings: function (configs) { + var ret = {}; + var cfg = configs['oozie-env']['oozie_user']; + if (cfg) { + ret.oozieUser = cfg; + } + return ret; + }, + + /** + * Set config values according to the new cluster topology + * + * @param {object} configs + * @param {MoveComponentConfigInitializerClass} initializer + * @param {object} [additionalDependencies={}] + * @returns {object} + * @method setDynamicConfigs + */ + setDynamicConfigs: function (configs, initializer, additionalDependencies) { + additionalDependencies = additionalDependencies || {}; + var topologyDB = this._prepareTopologyDB(), + dependencies = this._prepareDependencies(additionalDependencies), + initializerObjects = initializer.get('initializers'), + uniqueInitializerObjects = initializer.get('uniqueInitializers'); + Em.keys(configs).forEach(function (site) { + Em.keys(configs[site]).forEach(function (config) { + // temporary object for initializer + var cfg = { + name: config, + filename: site, + value: configs[site][config] + }; + configs[site][config] = initializer.initialValue(cfg, topologyDB, dependencies).value; + if (initializerObjects[config] || uniqueInitializerObjects[config]) { + if (!this.get('propertiesToChange').hasOwnProperty(site)) { + this.get('propertiesToChange')[site] = []; + } + this.get('propertiesToChange')[site].push({ + name: config + }); + } + }, this); + }, this); + return configs; + }, + + /** + * + * @returns {extendedTopologyLocalDB} + * @private + * @method _prepareTopologyDB + */ + _prepareTopologyDB: function () { + var ret = this.get('content').getProperties(['masterComponentHosts', 'slaveComponentHosts', 'hosts']); + ret.installedServices = App.Service.find().mapProperty('serviceName'); + return ret; + }, + + /** + * Create dependencies for Config Initializers + * + * @param {object} additionalDependencies some additional information that should be added + * @returns {reassignComponentDependencies} + * @private + * @method _prepareDependencies + */ + _prepareDependencies: function (additionalDependencies) { + additionalDependencies = additionalDependencies || {}; + var ret = {}; + ret.sourceHostName = this.get('content.reassignHosts.source'); + ret.targetHostName = this.get('content.reassignHosts.target'); + return Em.merge(ret, additionalDependencies); + }, + + updateServiceConfigs: function () { + var configs = this.get('configs'); + if (configs) { + this.get('selectedService.configs').forEach(function (property) { + var type = App.config.getConfigTagFromFileName(property.fileName); + configs[type][property.name] = property.value; + }, this); + } + }, + submit: function() { App.get('router.mainAdminKerberosController').getKDCSessionState(function() { App.router.send("next"); http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/controllers/main/service/reassign/step4_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign/step4_controller.js b/ambari-web/app/controllers/main/service/reassign/step4_controller.js index c9cc28f..b383da7 100644 --- a/ambari-web/app/controllers/main/service/reassign/step4_controller.js +++ b/ambari-web/app/controllers/main/service/reassign/step4_controller.js @@ -70,267 +70,19 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro hostComponents: [], - /** - * List of components, that do not need reconfiguration for moving to another host - * Reconfigure command will be skipped - */ - componentsWithoutReconfiguration: ['METRICS_COLLECTOR'], - - /** - * Map with lists of related services. - * Used to define list of services to stop/start. - */ - relatedServicesMap: { - 'JOBTRACKER': ['PIG', 'OOZIE'], - 'RESOURCEMANAGER': ['YARN', 'MAPREDUCE2', 'TEZ', 'PIG', 'OOZIE', 'SLIDER', 'SPARK'], - 'APP_TIMELINE_SERVER': ['YARN', 'MAPREDUCE2', 'TEZ', 'OOZIE', 'SLIDER', 'SPARK'], - 'HIVE_SERVER': ['HIVE', 'FALCON', 'ATLAS', 'OOZIE'], - 'HIVE_METASTORE': ['HIVE', 'PIG', 'FALCON', 'ATLAS', 'OOZIE'], - 'WEBHCAT_SERVER': ['HIVE'], - 'OOZIE_SERVER': ['OOZIE', 'FALCON', 'KNOX'], - 'MYSQL_SERVER': ['HIVE', 'OOZIE', 'RANGER', 'RANGER_KMS'], - 'METRICS_COLLECTOR': ['AMBARI_METRICS'] - }, - dbPropertyMap: { - 'HIVE_SERVER': 'javax.jdo.option.ConnectionDriverName', - 'HIVE_METASTORE': 'javax.jdo.option.ConnectionDriverName', - 'OOZIE_SERVER': 'oozie.service.JPAService.jdbc.url' - }, - - /** - * additional configs with template values - * Part of value to substitute has following format: "<replace-value>" - */ - additionalConfigsMap: [ - { - componentName: 'RESOURCEMANAGER', - configs: { - 'yarn-site': { - 'yarn.resourcemanager.address': '<replace-value>:8050', - 'yarn.resourcemanager.admin.address': '<replace-value>:8141', - 'yarn.resourcemanager.resource-tracker.address': '<replace-value>:8025', - 'yarn.resourcemanager.scheduler.address': '<replace-value>:8030', - 'yarn.resourcemanager.webapp.address': '<replace-value>:8088', - 'yarn.resourcemanager.hostname': '<replace-value>' - } - } - }, - { - componentName: 'JOBTRACKER', - configs: { - 'mapred-site': { - 'mapred.job.tracker.http.address': '<replace-value>:50030', - 'mapred.job.tracker': '<replace-value>:50300' - } - } - }, - { - componentName: 'SECONDARY_NAMENODE', - configs: { - 'hdfs-site': { - 'dfs.secondary.http.address': '<replace-value>:50090' - } - }, - configs_Hadoop2: { - 'hdfs-site': { - 'dfs.namenode.secondary.http-address': '<replace-value>:50090' - } - } - }, - { - componentName: 'NAMENODE', - configs: { - 'hdfs-site': { - 'dfs.http.address': '<replace-value>:50070', - 'dfs.https.address': '<replace-value>:50470' - }, - 'core-site': { - 'fs.default.name': 'hdfs://<replace-value>:8020' - } - }, - configs_Hadoop2: { - 'hdfs-site': { - 'dfs.namenode.rpc-address': '<replace-value>:8020', - 'dfs.namenode.http-address': '<replace-value>:50070', - 'dfs.namenode.https-address': '<replace-value>:50470' - }, - 'core-site': { - 'fs.defaultFS': 'hdfs://<replace-value>:8020' - } - } - }, - { - componentName: 'APP_TIMELINE_SERVER', - configs: { - 'yarn-site': { - 'yarn.timeline-service.webapp.address': '<replace-value>:8188', - 'yarn.timeline-service.webapp.https.address': '<replace-value>:8190', - 'yarn.timeline-service.address': '<replace-value>:10200' - } - } - }, - { - componentName: 'OOZIE_SERVER', - configs: { - 'oozie-site': { - 'oozie.base.url': 'http://<replace-value>:11000/oozie' - }, - 'core-site': { - 'hadoop.proxyuser.oozie.hosts': '<replace-value>' - } - } - }, - { - componentName: 'HIVE_METASTORE', - configs: { - 'hive-site': {} - } - }, - { - componentName: 'MYSQL_SERVER', - configs: { - 'hive-site': { - 'javax.jdo.option.ConnectionURL': 'jdbc:mysql://<replace-value>/hive?createDatabaseIfNotExist=true' - } - } - }, - { - componentName: 'HISTORYSERVER', - configs: { - 'mapred-site': { - 'mapreduce.jobhistory.webapp.address': '<replace-value>:19888', - 'mapreduce.jobhistory.address': '<replace-value>:10020' - } - } - } - ], - - secureConfigsMap: [ - { - componentName: 'NAMENODE', - configs: [ - { - site: 'hdfs-site', - keytab: 'dfs.namenode.keytab.file', - principal: 'dfs.namenode.kerberos.principal' - }, - { - site: 'hdfs-site', - keytab: 'dfs.web.authentication.kerberos.keytab', - principal: 'dfs.web.authentication.kerberos.principal' - } - ] - }, - { - componentName: 'SECONDARY_NAMENODE', - configs: [ - { - site: 'hdfs-site', - keytab: 'dfs.secondary.namenode.keytab.file', - principal: 'dfs.secondary.namenode.kerberos.principal' - }, - { - site: 'hdfs-site', - keytab: 'dfs.web.authentication.kerberos.keytab', - principal: 'dfs.web.authentication.kerberos.principal' - } - ] + 'HIVE_SERVER': { + type: 'hive-site', + name: 'javax.jdo.option.ConnectionDriverName' }, - { - componentName: 'RESOURCEMANAGER', - configs: [ - { - site: 'yarn-site', - keytab: 'yarn.resourcemanager.keytab', - principal: 'yarn.resourcemanager.principal' - }, - { - site: 'yarn-site', - keytab: 'yarn.resourcemanager.webapp.spnego-keytab-file', - principal: 'yarn.resourcemanager.webapp.spnego-principal' - } - ] - }, - { - componentName: 'OOZIE_SERVER', - configs: [ - { - site: 'oozie-site', - keytab: 'oozie.authentication.kerberos.keytab', - principal: 'oozie.authentication.kerberos.principal' - }, - { - site: 'oozie-site', - keytab: 'oozie.service.HadoopAccessorService.keytab.file', - principal: 'oozie.service.HadoopAccessorService.kerberos.principal' - } - ] - }, - { - componentName: 'WEBHCAT_SERVER', - configs: [ - { - site: 'webhcat-site', - keytab: 'templeton.kerberos.keytab', - principal: 'templeton.kerberos.principal' - } - ] + 'HIVE_METASTORE': { + type: 'hive-site', + name: 'javax.jdo.option.ConnectionDriverName' }, - { - componentName: 'HIVE_SERVER', - configs: [ - { - site: 'hive-site', - keytab: 'hive.server2.authentication.kerberos.keytab', - principal: 'hive.server2.authentication.kerberos.principal' - }, - { - site: 'hive-site', - keytab: 'hive.server2.authentication.spnego.keytab', - principal: 'hive.server2.authentication.spnego.principal' - } - ] - }, - { - componentName: 'HIVE_METASTORE', - configs: [ - { - site: 'hive-site', - keytab: 'hive.metastore.kerberos.keytab.file', - principal: 'hive.metastore.kerberos.principal' - } - ] - } - - ], - - /** - * set additional configs - * configs_Hadoop2 - configs which belongs to Hadoop 2 stack only - * @param configs - * @param componentName - * @param replaceValue - * @return {Boolean} - */ - setAdditionalConfigs: function (configs, componentName, replaceValue) { - var component = this.get('additionalConfigsMap').findProperty('componentName', componentName); - - if (Em.isNone(component)) return false; - var additionalConfigs = (component.configs_Hadoop2) ? component.configs_Hadoop2 : component.configs; - - for (var site in additionalConfigs) { - if (additionalConfigs.hasOwnProperty(site)) { - for (var property in additionalConfigs[site]) { - if (additionalConfigs[site].hasOwnProperty(property)) { - if (App.get('isHaEnabled') && componentName === 'NAMENODE' && (property === 'fs.defaultFS' || property === 'dfs.namenode.rpc-address')) continue; - - configs[site][property] = additionalConfigs[site][property].replace('<replace-value>', replaceValue); - } - } - } + 'OOZIE_SERVER': { + type: 'oozie-site', + name: 'oozie.service.JPAService.jdbc.url' } - return true; }, /** @@ -397,7 +149,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro this.removeTasks(['startZooKeeperServers', 'startNameNode']); } - if (this.get('componentsWithoutReconfiguration').contains(componentName)) { + if (!this.get('wizardController.isComponentWithReconfiguration')) { this.removeTasks(['reconfigure']); } @@ -457,7 +209,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro * make server call to stop services */ stopRequiredServices: function () { - this.stopServices(this.get('relatedServicesMap')[this.get('content.reassign.component_name')], true); + this.stopServices(this.get('wizardController.relatedServicesMap')[this.get('content.reassign.component_name')], true); }, createHostComponents: function () { @@ -502,309 +254,11 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro }, reconfigure: function () { - this.loadConfigsTags(); - }, - - loadConfigsTags: function () { - App.ajax.send({ - name: 'config.tags', - sender: this, - success: 'onLoadConfigsTags', - error: 'onTaskError' - }); - }, - - serviceToConfigSiteMap: { - 'NAMENODE': ['hdfs-site', 'core-site'], - 'SECONDARY_NAMENODE': ['hdfs-site', 'core-site'], - 'JOBTRACKER': ['mapred-site'], - 'RESOURCEMANAGER': ['yarn-site'], - 'WEBHCAT_SERVER': ['hive-env', 'webhcat-site', 'core-site'], - 'APP_TIMELINE_SERVER': ['yarn-site', 'yarn-env'], - 'OOZIE_SERVER': ['oozie-site', 'core-site', 'oozie-env'], - 'HIVE_SERVER': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'], - 'HIVE_METASTORE': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'], - 'MYSQL_SERVER': ['hive-site'], - 'HISTORYSERVER': ['mapred-site'] - }, - - /** - * construct URL parameters for config call - * @param componentName - * @param data - * @return {Array} - */ - getConfigUrlParams: function (componentName, data) { - var urlParams = []; - - this.get('serviceToConfigSiteMap')[componentName].forEach(function(site){ - urlParams.push('(type=' + site + '&tag=' + data.Clusters.desired_configs[site].tag + ')'); - }); - - // specific cases for NameNode component - if (componentName === 'NAMENODE') { - if (App.Service.find().someProperty('serviceName', 'HBASE')) { - urlParams.push('(type=hbase-site&tag=' + data.Clusters.desired_configs['hbase-site'].tag + ')'); - } - if (App.Service.find().someProperty('serviceName', 'ACCUMULO')) { - urlParams.push('(type=accumulo-site&tag=' + data.Clusters.desired_configs['accumulo-site'].tag + ')'); - } - if (App.Service.find().someProperty('serviceName', 'HAWQ')) { - urlParams.push('(type=hawq-site&tag=' + data.Clusters.desired_configs['hawq-site'].tag + ')'); - urlParams.push('(type=hdfs-client&tag=' + data.Clusters.desired_configs['hdfs-client'].tag + ')'); - } - } - - if (componentName === 'RESOURCEMANAGER') { - if (App.Service.find().someProperty('serviceName', 'HAWQ')) { - urlParams.push('(type=hawq-site&tag=' + data.Clusters.desired_configs['hawq-site'].tag + ')'); - urlParams.push('(type=yarn-client&tag=' + data.Clusters.desired_configs['yarn-client'].tag + ')'); - } - } - - return urlParams; - }, - - onLoadConfigsTags: function (data) { - var urlParams = this.getConfigUrlParams(this.get('content.reassign.component_name'), data); - - App.ajax.send({ - name: 'reassign.load_configs', - sender: this, - data: { - urlParams: urlParams.join('|') - }, - success: 'onLoadConfigs', - error: 'onTaskError' - }); - }, - - /** - * - * @returns {extendedTopologyLocalDB} - * @private - * @method _prepareTopologyDB - */ - _prepareTopologyDB: function () { - var ret = this.get('content').getProperties(['masterComponentHosts', 'slaveComponentHosts', 'hosts']); - ret.installedServices = App.Service.find().mapProperty('serviceName'); - return ret; - }, - - /** - * Create dependencies for Config Initializers - * - * @param {object} additionalDependencies some additional information that should be added - * @returns {reassignComponentDependencies} - * @private - * @method _prepareDependencies - */ - _prepareDependencies: function (additionalDependencies) { - additionalDependencies = additionalDependencies || {}; - var ret = {}; - ret.sourceHostName = this.get('content.reassignHosts.source'); - ret.targetHostName = this.get('content.reassignHosts.target'); - return Em.merge(ret, additionalDependencies); - }, - - /** - * Get additional dependencies-data for App.MoveRmConfigInitializer - * - * @param {object} configs - * @returns {object} - * @private - * @method _getRmAdditionalDependencies - */ - _getRmAdditionalDependencies: function (configs) { - var ret = {}; - var rm1 = configs['yarn-site']['yarn.resourcemanager.hostname.rm1']; - if (rm1) { - ret.rm1 = rm1; - } - var rm2 = configs['yarn-site']['yarn.resourcemanager.hostname.rm2']; - if (rm2) { - ret.rm2 = rm2; - } - return ret; - }, - - /** - * Settings used to the App.MoveOSConfigInitializer setup - * - * @param {object} configs - * @returns {object} - * @private - * @method _getOsInitializerSettings - */ - _getOsInitializerSettings: function (configs) { - var ret = {}; - var cfg = configs['oozie-env']['oozie_user']; - if (cfg) { - ret.oozieUser = cfg; - } - return ret; - }, - - /** - * Get additional dependencies-data for App.MoveNameNodeConfigInitializer - * - * @param {object} configs - * @returns {object} - * @private - * @method _getNnInitializerSettings - */ - _getNnInitializerSettings: function (configs) { - var ret = {}; - if (App.get('isHaEnabled')) { - ret.namespaceId = configs['hdfs-site']['dfs.nameservices']; - ret.suffix = (configs['hdfs-site']['dfs.namenode.http-address.' + ret.namespaceId + '.nn1'].indexOf(this.get('content.reassignHosts.source')) != -1) ? 'nn1' : 'nn2'; - } - return ret; - }, - - /** - * Settings used to the App.MoveHsConfigInitializer and App.MoveHmConfigInitializer setup - * - * @param {object} configs - * @returns {{hiveUser: string}} - * @private - * @method _getHiveInitializerSettings - */ - _getHiveInitializerSettings: function (configs) { - return { - hiveUser: configs['hive-env']['hive_user'] - }; - }, - - /** - * Settings used to the App.MoveWsConfigInitializer setup - * - * @param {object} configs - * @returns {{webhcatUser: string}} - * @private - * @method _getWsInitializerSettings - */ - _getWsInitializerSettings: function (configs) { - return { - webhcatUser: configs['hive-env']['webhcat_user'] - }; - }, - - /** - * Settings used to the App.MoveRmConfigInitializer setup - * - * @param {object} configs - * @returns {{suffix: string}} - * @private - * @method _getRmInitializerSettings - */ - _getRmInitializerSettings: function (configs) { - return { - suffix: configs['yarn-site']['yarn.resourcemanager.hostname.rm1'] === this.get('content.reassignHosts.source') ? 'rm1': 'rm2' - }; - }, - - onLoadConfigs: function (data) { - // Find hawq-site.xml location - var hawqSiteIndex = -1; - for(var i = 0; i < data.items.length; i++){ - if(data.items[i].type == 'hawq-site'){ - hawqSiteIndex = i; - break; - } - } - - // if certain services are deployed, include related site files to additionalConfigsMap and relatedServicesMap. - if(hawqSiteIndex >= 0){ // if HAWQ is deployed - var hawqSiteProperties = { - 'hawq_rm_yarn_address': '<replace-value>:8050', - 'hawq_rm_yarn_scheduler_address': '<replace-value>:8030' - } - - var rmComponent = this.get('additionalConfigsMap').findProperty('componentName', "RESOURCEMANAGER"); - rmComponent.configs["hawq-site"] = hawqSiteProperties; - - if(data.items[hawqSiteIndex].properties["hawq_global_rm_type"].toLowerCase() === "yarn"){ - this.get('relatedServicesMap')['RESOURCEMANAGER'].append('HAWQ'); - } - - } - - var componentName = this.get('content.reassign.component_name'); - var targetHostName = this.get('content.reassignHosts.target'); - var configs = {}; - var secureConfigs = []; - - data.items.forEach(function (item) { - configs[item.type] = item.properties; - }, this); - - this.setAdditionalConfigs(configs, componentName, targetHostName); - this.setSecureConfigs(secureConfigs, configs, componentName); - - switch (componentName) { - case 'NAMENODE': - App.MoveNameNodeConfigInitializer.setup(this._getNnInitializerSettings(configs)); - configs = this.setDynamicConfigs(configs, App.MoveNameNodeConfigInitializer); - App.MoveNameNodeConfigInitializer.cleanup(); - break; - case 'RESOURCEMANAGER': - App.MoveRmConfigInitializer.setup(this._getRmInitializerSettings(configs)); - var additionalDependencies = this._getRmAdditionalDependencies(configs); - configs = this.setDynamicConfigs(configs, App.MoveRmConfigInitializer, additionalDependencies); - App.MoveRmConfigInitializer.cleanup(); - break; - case 'HIVE_METASTORE': - App.MoveHmConfigInitializer.setup(this._getHiveInitializerSettings(configs)); - configs = this.setDynamicConfigs(configs, App.MoveHmConfigInitializer); - App.MoveHmConfigInitializer.cleanup(); - break; - case 'HIVE_SERVER': - App.MoveHsConfigInitializer.setup(this._getHiveInitializerSettings(configs)); - configs = this.setDynamicConfigs(configs, App.MoveHsConfigInitializer); - App.MoveHsConfigInitializer.cleanup(); - break; - case 'WEBHCAT_SERVER': - App.MoveWsConfigInitializer.setup(this._getWsInitializerSettings(configs)); - configs = this.setDynamicConfigs(configs, App.MoveWsConfigInitializer); - App.MoveWsConfigInitializer.cleanup(); - break; - case 'OOZIE_SERVER': - App.MoveOSConfigInitializer.setup(this._getOsInitializerSettings(configs)); - configs = this.setDynamicConfigs(configs, App.MoveOSConfigInitializer); - App.MoveOSConfigInitializer.cleanup(); - } - + var configs = this.get('content.configs'), + secureConfigs = this.get('content.secureConfigs'), + componentName = this.get('content.reassign.component_name'); this.saveClusterStatus(secureConfigs, this.getComponentDir(configs, componentName)); this.saveConfigsToServer(configs); - this.saveServiceProperties(configs); - }, - - /** - * Set config values according to the new cluster topology - * - * @param {object} configs - * @param {MoveComponentConfigInitializerClass} initializer - * @param {object} [additionalDependencies={}] - * @returns {object} - * @method setDynamicConfigs - */ - setDynamicConfigs: function (configs, initializer, additionalDependencies) { - additionalDependencies = additionalDependencies || {}; - var topologyDB = this._prepareTopologyDB(); - var dependencies = this._prepareDependencies(additionalDependencies); - Em.keys(configs).forEach(function (site) { - Em.keys(configs[site]).forEach(function (config) { - // temporary object for initializer - var cfg = { - name: config, - filename: site, - value: configs[site][config] - }; - configs[site][config] = initializer.initialValue(cfg, topologyDB, dependencies).value; - }); - }); - return configs; }, /** @@ -884,27 +338,6 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro }, /** - * set secure configs for component - * @param secureConfigs - * @param configs - * @param componentName - * @return {Boolean} - */ - setSecureConfigs: function (secureConfigs, configs, componentName) { - var securityEnabled = App.get('isKerberosEnabled'); - var component = this.get('secureConfigsMap').findProperty('componentName', componentName); - if (Em.isNone(component) || !securityEnabled) return false; - - component.configs.forEach(function (config) { - secureConfigs.push({ - keytab: configs[config.site][config.keytab], - principal: configs[config.site][config.principal] - }); - }); - return true; - }, - - /** * derive component directory from configurations * @param configs * @param componentName @@ -966,7 +399,7 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro * make server call to start services */ startRequiredServices: function () { - var relatedServices = this.get('relatedServicesMap')[this.get('content.reassign.component_name')]; + var relatedServices = this.get('wizardController.relatedServicesMap')[this.get('content.reassign.component_name')]; if (relatedServices) { this.startServices(false, relatedServices, true); } else { @@ -1150,10 +583,11 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro }.property('propertiesPattern'), getConnectionProperty: function(regexp) { - var propertyName = this.get('requiredProperties').filter(function(item) { + var configType = this.get('requiredProperties.type'), + propertyName = this.get('requiredProperties.names').filter(function(item) { return regexp.test(item); })[0]; - return this.get('content.serviceProperties')[propertyName]; + return Em.getWithDefault(this.get('content.configs'), configType, {})[propertyName]; }, /** @@ -1174,18 +608,35 @@ App.ReassignMasterWizardStep4Controller = App.HighAvailabilityProgressPageContro /** @property {object} requiredProperties - properties that necessary for database connection **/ requiredProperties: function() { var propertiesMap = { - OOZIE: ['oozie.db.schema.name','oozie.service.JPAService.jdbc.username','oozie.service.JPAService.jdbc.password','oozie.service.JPAService.jdbc.driver','oozie.service.JPAService.jdbc.url'], - HIVE: ['ambari.hive.db.schema.name','javax.jdo.option.ConnectionUserName','javax.jdo.option.ConnectionPassword','javax.jdo.option.ConnectionDriverName','javax.jdo.option.ConnectionURL'] + OOZIE: { + type: 'oozie-site', + names: ['oozie.db.schema.name', 'oozie.service.JPAService.jdbc.username', 'oozie.service.JPAService.jdbc.password', 'oozie.service.JPAService.jdbc.driver', 'oozie.service.JPAService.jdbc.url'] + }, + HIVE: { + type: 'hive-site', + names: ['ambari.hive.db.schema.name', 'javax.jdo.option.ConnectionUserName', 'javax.jdo.option.ConnectionPassword', 'javax.jdo.option.ConnectionDriverName', 'javax.jdo.option.ConnectionURL'] + } }; return propertiesMap[this.get('content.reassign.service_id')]; }.property(), dbType: function() { - var databaseTypes = /MySQL|PostgreS|Oracle|Derby|MSSQL|Anywhere/gi; - var databaseProp = this.get('content.serviceProperties')[Em.getWithDefault(this.get('dbPropertyMap'), this.get('content.reassign.component_name'), null)]; + var databaseTypes = /MySQL|PostgreS|Oracle|Derby|MSSQL|Anywhere/gi, + dbPropertyMapItem = Em.getWithDefault(this.get('dbPropertyMap'), this.get('content.reassign.component_name'), null), + databasePropMatch, + databaseProp, + result; + + if (dbPropertyMapItem) { + databaseProp = Em.getWithDefault(this.get('content.configs'), dbPropertyMapItem.type, {})[dbPropertyMapItem.name]; + databasePropMatch = databaseProp && databaseProp.match(databaseTypes); + if (databasePropMatch) { + result = databasePropMatch[0]; + } + } - return databaseProp.match(databaseTypes)[0]; + return result; }.property(), prepareDBCheckAction: function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/controllers/main/service/reassign_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/reassign_controller.js b/ambari-web/app/controllers/main/service/reassign_controller.js index 07d6e2c..e512835 100644 --- a/ambari-web/app/controllers/main/service/reassign_controller.js +++ b/ambari-web/app/controllers/main/service/reassign_controller.js @@ -131,6 +131,8 @@ App.ReassignMasterController = App.WizardController.extend({ this.loadTasksRequestIds(); this.loadRequestIds(); this.loadReassignComponentsInMM(); + this.loadConfigs(); + this.loadSecureConfigs(); } } ], @@ -138,13 +140,46 @@ App.ReassignMasterController = App.WizardController.extend({ { type: 'sync', callback: function () { - this.loadSecureConfigs(); this.loadComponentDir(); } } ] }, + serviceToConfigSiteMap: { + 'NAMENODE': ['hdfs-site', 'core-site'], + 'SECONDARY_NAMENODE': ['hdfs-site', 'core-site'], + 'JOBTRACKER': ['mapred-site'], + 'RESOURCEMANAGER': ['yarn-site'], + 'WEBHCAT_SERVER': ['hive-env', 'webhcat-site', 'core-site'], + 'APP_TIMELINE_SERVER': ['yarn-site', 'yarn-env'], + 'OOZIE_SERVER': ['oozie-site', 'core-site', 'oozie-env'], + 'HIVE_SERVER': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'], + 'HIVE_METASTORE': ['hive-site', 'webhcat-site', 'hive-env', 'core-site'], + 'MYSQL_SERVER': ['hive-site'], + 'HISTORYSERVER': ['mapred-site'] + }, + + /** + * Map with lists of related services. + * Used to define list of services to stop/start. + */ + relatedServicesMap: { + 'JOBTRACKER': ['PIG', 'OOZIE'], + 'RESOURCEMANAGER': ['YARN', 'MAPREDUCE2', 'TEZ', 'PIG', 'OOZIE', 'SLIDER', 'SPARK'], + 'APP_TIMELINE_SERVER': ['YARN', 'MAPREDUCE2', 'TEZ', 'OOZIE', 'SLIDER', 'SPARK'], + 'HIVE_SERVER': ['HIVE', 'FALCON', 'ATLAS', 'OOZIE'], + 'HIVE_METASTORE': ['HIVE', 'PIG', 'FALCON', 'ATLAS', 'OOZIE'], + 'WEBHCAT_SERVER': ['HIVE'], + 'OOZIE_SERVER': ['OOZIE', 'FALCON', 'KNOX'], + 'MYSQL_SERVER': ['HIVE', 'OOZIE', 'RANGER', 'RANGER_KMS'], + 'METRICS_COLLECTOR': ['AMBARI_METRICS'] + }, + + isComponentWithReconfiguration: function () { + return this.get('serviceToConfigSiteMap').hasOwnProperty(this.get('content.reassign.component_name')); + }.property('content.reassign.component_name'), + addManualSteps: function () { var hasManualSteps = this.get('content.componentsWithManualCommands').contains(this.get('content.reassign.component_name')); this.set('content.hasManualSteps', hasManualSteps); @@ -285,6 +320,16 @@ App.ReassignMasterController = App.WizardController.extend({ this.set('content.serviceProperties', serviceProperties); }, + saveConfigs: function (configs) { + this.setDBProperty('configs', configs); + this.set('content.configs', configs); + }, + + loadConfigs: function () { + var configs = this.getDBProperty('configs'); + this.set('content.configs', configs); + }, + saveDatabaseType: function (type) { this.setDBProperty('databaseType', type); this.set('content.databaseType', type); http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/messages.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js index 7ed5826..cacb798 100644 --- a/ambari-web/app/messages.js +++ b/ambari-web/app/messages.js @@ -1316,7 +1316,8 @@ Em.I18n.translations = { 'admin.manageJournalNode.wizard.step8.header': 'Start All Services', 'admin.manageJournalNode.wizard.step1.body': 'Add, or Remove JournalNodes', - 'admin.manageJournalNode.wizard.step3.confirm.config.body': '<b>Configuration Change Review.</b></br>' + + 'admin.manageJournalNode.wizard.step3.confirm.hosts.body': '<b>Confirm your host selections.</b>', + 'admin.manageJournalNode.wizard.step3.confirm.config.body': '<p><b>Review Configuration Changes.</b></p>' + 'As part of this process, configuration changes are required. Please review the changes below, and note that they are for <b>review only</b>. Future steps in this wizard will update this configuration, and restart <b>all</b> services automatically.', 'admin.manageJournalNode.wizard.step4.task0.title' : 'Stop Standby NameNode', @@ -1541,7 +1542,7 @@ Em.I18n.translations = { '</ol>', 'admin.highAvailability.wizard.step3.confirm.host.body':'<b>Confirm your host selections.</b>', 'admin.highAvailability.wizard.step3.confirm.config.body':'<div class="alert alert-info">' + - '<b>Review Configuration Changes.</b></br>' + + '<p><b>Review Configuration Changes.</b></p>' + 'The following lists the configuration changes that will be made by the Wizard to enable NameNode HA. This information is for <b> review only </b> and is not editable except for the <b>dfs.journalnode.edits.dir</b> property' + '</div>', 'admin.highAvailability.wizard.step2.body':'Select a host that will be running the additional NameNode.<br/> In addition,' + @@ -1568,7 +1569,7 @@ Em.I18n.translations = { 'admin.rm_highAvailability.wizard.step3.header': 'Review', 'admin.rm_highAvailability.wizard.step3.confirm.host.body':'<b>Confirm your host selections.</b>', 'admin.rm_highAvailability.wizard.step3.confirm.config.body':'<div class="alert alert-info">' + - '<b>Review Configuration Changes.</b></br>' + + '<p><b>Review Configuration Changes.</b></p>' + 'The following lists the configuration changes that will be made by the Wizard to enable ResourceManager HA. This information is for <b> review only </b> and is not editable.' + '</div>', 'admin.rm_highAvailability.wizard.step3.currentRM': 'Current ResourceManager', @@ -1600,7 +1601,7 @@ Em.I18n.translations = { 'admin.ra_highAvailability.wizard.step3.alert_message': '<b>Confirm your host selections.</b>', 'admin.ra_highAvailability.wizard.step3.currentRA': 'Current Ranger Admin', 'admin.ra_highAvailability.wizard.step3.additionalRA': 'Additional Ranger Admin', - 'admin.rm_highAvailability.wizard.step3.configs_changes': '<b>Review Configuration Changes.</b></br>' + + 'admin.rm_highAvailability.wizard.step3.configs_changes': '<p><b>Review Configuration Changes.</b></p>' + '<i>policymgr_external_url</i> in admin-properties.xml will be changed by the Wizard to enable Ranger Admin HA', 'admin.ra_highAvailability.wizard.step4.header': 'Install, Start and Test', 'admin.ra_highAvailability.wizard.step4.task0.title': 'Stop All Services', @@ -2284,10 +2285,12 @@ Em.I18n.translations = { 'services.reassign.step2.body':'Assign {0} to new host.', 'services.reassign.step2.body.namenodeHA':'Move {0} to new host. You can move only one master component at a time.', 'services.reassign.step3.header':'Review', - 'services.reassign.step3.body':'Please review the changes you made', + 'services.reassign.step3.body':'<b>Confirm your host selections.</b>', 'services.reassign.step3.targetHost':'Target Host:', 'services.reassign.step3.sourceHost':'Source Host:', 'services.reassign.step3.component':'Component name:', + 'services.reassign.step3.configs':'<div class="alert alert-info">' + + '<p><b>Review Configuration Changes.</b></p>The Wizard will make the following configuration changes.</div>', 'services.reassign.step4.header':'Configure Component', 'services.reassign.step4.tasks.stopRequiredServices.title':'Stop Required Services', @@ -3245,8 +3248,8 @@ Em.I18n.translations = { 'admin.addHawqStandby.wizard.step3.header': 'Review', 'admin.addHawqStandby.wizard.step3.configs_changes': 'Review Configuration Changes.', 'admin.addHawqStandby.wizard.step3.confirm.host.body':'<b>Confirm your host selections.</b>', - 'admin.addHawqStandby.wizard.step3.confirm.config.body':'<div class="alert alert-info">' + - '<b>Review Configuration Changes.</b><br/><br/>' + + 'admin.addHawqStandby.wizard.step3.confirm.config.body':'<p class="alert alert-info">' + + '<p><b>Review Configuration Changes.</b></p>' + 'The following lists the configuration changes that will be made by the Wizard to add HAWQ Standby Master. ' + 'This information is for <b> review only </b> and is not editable.</div>', 'admin.addHawqStandby.wizard.step3.hawqMaster': 'Current HAWQ Master', @@ -3277,7 +3280,7 @@ Em.I18n.translations = { 'admin.removeHawqStandby.wizard.step2.header': 'Review', 'admin.removeHawqStandby.wizard.step2.hawqStandby': '<b>Current HAWQ Standby:</b>', 'admin.removeHawqStandby.wizard.step2.confirm.config.body':'<div class="alert alert-info">' + - '<b>Review Configuration Changes.</b></br></br>After removing the HAWQ Standby Master, the Wizard removes the ' + + '<p><b>Review Configuration Changes.</b></p>After removing the HAWQ Standby Master, the Wizard removes the ' + 'hawq_standby_address_host property from hawq-site.xml. As a best practice, you should configure a new HAWQ Standby Master host after the Wizard completes.</div>', 'admin.removeHawqStandby.wizard.step2.confirm.host.body':'<b>Review HAWQ Standby Master role changes.</b>', 'admin.removeHawqStandby.wizard.step2.confirmPopup.body': 'Do you wish to continue with removing HAWQ Standby Master? Please confirm, before proceeding as you will not be able to rollback from Ambari.', @@ -3312,7 +3315,7 @@ Em.I18n.translations = { 'admin.activateHawqStandby.wizard.step2.toBeActivated': 'TO BE ACTIVATED AS NEW HAWQ MASTER', 'admin.activateHawqStandby.step4.save.configuration.note': 'This configuration is created by Activate HAWQ Standby wizard', 'admin.activateHawqStandby.wizard.step2.confirm.config.body': '<div class="alert alert-info">' + - '<b>Review Configuration Changes.</b><br/><br/>The Wizard will make the following configuration changes. '+ + '<p><b>Review Configuration Changes.</b></p>The Wizard will make the following configuration changes. '+ 'This information is for review only, and cannot be edited.<br/><br/><b>After activating the HAWQ Standby ' + 'Master, the wizard removes the hawq_standby_address_host property from hawq-site.xml.</b> ' + 'As a best practice, you should configure a new HAWQ Standby Master host after the wizard completes.</div>', http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/routes/reassign_master_routes.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/routes/reassign_master_routes.js b/ambari-web/app/routes/reassign_master_routes.js index 10ad0e9..a2a9743 100644 --- a/ambari-web/app/routes/reassign_master_routes.js +++ b/ambari-web/app/routes/reassign_master_routes.js @@ -170,16 +170,21 @@ module.exports = App.WizardRoute.extend({ step3: Em.Route.extend({ route: '/step3', connectOutlets: function (router) { - var controller = router.get('reassignMasterController'); + var controller = router.get('reassignMasterController'), + stepController = router.get('reassignMasterWizardStep3Controller'); controller.setCurrentStep('3'); controller.dataLoading().done(function () { controller.loadAllPriorSteps(); + stepController.set('wizardController', controller); controller.connectOutlet('reassignMasterWizardStep3', controller.get('content')); }) }, back: Em.Router.transitionTo('step2'), next: function (router) { - var controller = router.get('reassignMasterController'); + var controller = router.get('reassignMasterController'), + stepController = router.get('reassignMasterWizardStep3Controller'), + configs = stepController.get('configs'), + secureConfigs = stepController.get('secureConfigs'); App.db.setReassignTasksStatuses(undefined); App.db.setReassignTasksRequestIds(undefined); App.clusterStatus.setClusterStatus({ @@ -189,9 +194,16 @@ module.exports = App.WizardRoute.extend({ localdb: App.db.data }); controller.saveReassignComponentsInMM(controller.getReassignComponentsInMM()); + stepController.updateServiceConfigs(); + controller.saveConfigs(configs); + controller.saveSecureConfigs(secureConfigs); router.transitionTo('step4'); }, + exit: function (router) { + router.get('reassignMasterWizardStep3Controller').clearStep(); + }, + unroutePath: function () { return false; } @@ -200,11 +212,13 @@ module.exports = App.WizardRoute.extend({ step4: Em.Route.extend({ route: '/step4', connectOutlets: function (router) { - var controller = router.get('reassignMasterController'); + var controller = router.get('reassignMasterController'), + stepController = router.get('reassignMasterWizardStep4Controller'); controller.setCurrentStep('4'); controller.setLowerStepsDisable(4); router.get('mainController').isLoading.call(router.get('clusterController'), 'isServiceContentFullyLoaded').done(function () { controller.loadAllPriorSteps(); + stepController.set('wizardController', controller); controller.connectOutlet('reassignMasterWizardStep4', controller.get('content')); }); }, @@ -304,11 +318,13 @@ module.exports = App.WizardRoute.extend({ step7: Em.Route.extend({ route: '/step7', connectOutlets: function (router) { - var controller = router.get('reassignMasterController'); + var controller = router.get('reassignMasterController'), + stepController = router.get('reassignMasterWizardStep7Controller'); controller.setCurrentStep('7'); controller.setLowerStepsDisable(7); controller.dataLoading().done(function () { controller.loadAllPriorSteps(); + stepController.set('wizardController', controller); controller.connectOutlet('reassignMasterWizardStep7', controller.get('content')); }); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/styles/wizard.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/wizard.less b/ambari-web/app/styles/wizard.less index 2dbdd03..579b21b 100644 --- a/ambari-web/app/styles/wizard.less +++ b/ambari-web/app/styles/wizard.less @@ -377,7 +377,7 @@ margin-top: 8px; } - #ha-step3-review-table, #manage-journal-node-step2-review-table { + #ha-step3-review-table, #manage-journal-node-step2-review-table, #reassign-review-table { td { text-align: left; vertical-align: top; http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs b/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs index 0cd177d..d537585 100644 --- a/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs +++ b/ambari-web/app/templates/main/admin/highAvailability/journalNode/step2.hbs @@ -18,63 +18,66 @@ <div class="wizard-content col-md-9"> <h4 class="step-title">{{t admin.manageJournalNode.wizard.step2.header}}</h4> + <p class="step-description"> + {{t admin.manageJournalNode.wizard.step3.confirm.hosts.body}} + </p> <div class="panel panel-default"> <div class="panel-body"> - <div id="manage-journal-node-step2-content" class="well pre-scrollable"> - <div id="step8-info"> - <table id="manage-journal-node-step2-review-table"> + <div id="manage-journal-node-step2-content" class="well pre-scrollable"> + <div id="step8-info"> + <table id="manage-journal-node-step2-review-table"> {{#if view.journalNodesToAdd.length}} - <tr> + <tr> <td>{{t admin.highAvailability.wizard.step3.journalNode}}</td> <td> - <ul> - {{#each item in view.journalNodesToAdd}} - <li>{{item}}</li> - {{/each}} - </ul> + <ul> + {{#each item in view.journalNodesToAdd}} + <li>{{item}}</li> + {{/each}} + </ul> </td> <td> - <ul> - {{#each item in view.journalNodesToAdd}} - <li><span class="to-be-installed-green"><i class="icon-plus"></i> + <ul> + {{#each item in view.journalNodesToAdd}} + <li><span class="to-be-installed-green"><i class="icon-plus"></i> {{t admin.highAvailability.wizard.step3.toBeInstalled}}</span></li> - {{/each}} - </ul> + {{/each}} + </ul> </td> - </tr> + </tr> {{/if}} {{#if view.journalNodesToDelete.length}} - <tr> + <tr> <td>{{t admin.highAvailability.wizard.step3.journalNode}}</td> <td> - <ul> - {{#each item in view.journalNodesToDelete}} - <li>{{item}}</li> - {{/each}} - </ul> + <ul> + {{#each item in view.journalNodesToDelete}} + <li>{{item}}</li> + {{/each}} + </ul> </td> <td> - <ul> - {{#each item in view.journalNodesToDelete}} - <li><span class="to-be-disabled-red"><i class="icon-minus"></i> + <ul> + {{#each item in view.journalNodesToDelete}} + <li><span class="to-be-disabled-red"><i class="icon-minus"></i> {{t admin.highAvailability.wizard.step3.toBeDeleted}}</span></li> - {{/each}} - </ul> + {{/each}} + </ul> </td> - </tr> + </tr> {{/if}} - </table> + </table> + </div> </div> - </div> <div id="serviceConfig"> {{#if controller.isLoaded}} <div class="alert alert-info"> {{{t admin.manageJournalNode.wizard.step3.confirm.config.body}}} </div> - {{view App.ServiceConfigView isNotEditableBinding="controller.isNotEditable"}} + {{view App.ServiceConfigView isNotEditableBinding="controller.isNotEditable"}} {{else}} - {{view App.SpinnerView}} + {{view App.SpinnerView}} {{/if}} </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/templates/main/service/reassign/step3.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/reassign/step3.hbs b/ambari-web/app/templates/main/service/reassign/step3.hbs index 1f88fb5..1f6a393 100644 --- a/ambari-web/app/templates/main/service/reassign/step3.hbs +++ b/ambari-web/app/templates/main/service/reassign/step3.hbs @@ -28,17 +28,37 @@ <div class="panel panel-default"> <div class="panel-body"> <div id="step8-content" class="well pre-scrollable"> - <div id="printReview"> - <a class="btn btn-info pull-right" {{action printReview target="view"}}>{{t common.print}}</a> <br/> - </div> <div id="step8-info"> - <p><b>{{t services.reassign.step3.component}}</b> {{controller.content.reassign.display_name}}</p> - - <p><b>{{t services.reassign.step3.sourceHost}}</b> {{view.sourceHost}}</p> - - <p><b>{{t services.reassign.step3.targetHost}}</b> {{view.targetHost}}</p> + <table id="reassign-review-table"> + <tr> + <td><b>{{t services.reassign.step3.component}}</b></td> + <td colspan="2">{{controller.content.reassign.display_name}}</td> + </tr> + <tr> + <td><b>{{t services.reassign.step3.sourceHost}}</b></td> + <td>{{view.sourceHost}}</td> + <td><span class="to-be-disabled-red"><i class="glyphicon glyphicon-minus"></i> {{t admin.highAvailability.wizard.step3.toBeDeleted}}</span></td> + </tr> + <tr> + <td><b>{{t services.reassign.step3.targetHost}}</b></td> + <td>{{view.targetHost}}</td> + <td><span class="to-be-installed-green"><i class="glyphicon glyphicon-plus"></i> {{t admin.highAvailability.wizard.step3.toBeInstalled}}</span></td> + </tr> + </table> </div> </div> + {{#if wizardController.isComponentWithReconfiguration}} + {{#if isLoaded}} + {{#if stepConfigs.length}} + <div id="serviceConfig"> + {{t services.reassign.step3.configs}} + {{view App.ServiceConfigView}} + </div> + {{/if}} + {{else}} + {{view App.SpinnerView}} + {{/if}} + {{/if}} </div> </div> </div> http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/views/main/service/reassign/step3_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/service/reassign/step3_view.js b/ambari-web/app/views/main/service/reassign/step3_view.js index 003fcb6..b6a379e 100644 --- a/ambari-web/app/views/main/service/reassign/step3_view.js +++ b/ambari-web/app/views/main/service/reassign/step3_view.js @@ -27,8 +27,8 @@ App.ReassignMasterWizardStep3View = Em.View.extend({ targetHost: Em.computed.alias('controller.content.reassignHosts.target'), - printReview: function () { - $("#step8-info").jqprint(); + didInsertElement: function () { + this.get('controller').loadStep(); }, jdbcSetupMessage: function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/app/views/main/service/reassign/step5_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/service/reassign/step5_view.js b/ambari-web/app/views/main/service/reassign/step5_view.js index 3a063b5..9c4f39d 100644 --- a/ambari-web/app/views/main/service/reassign/step5_view.js +++ b/ambari-web/app/views/main/service/reassign/step5_view.js @@ -43,8 +43,8 @@ App.ReassignMasterWizardStep5View = Em.View.extend({ } if (this.get('controller.content.reassign.component_name') === 'APP_TIMELINE_SERVER') { - user = this.get('controller.content.serviceProperties.yarn-env.yarn_user'); - path = this.get('controller.content.serviceProperties.yarn-site')['yarn.timeline-service.leveldb-timeline-store.path']; + user = this.get('controller.content.configs.yarn-env.yarn_user'); + path = this.get('controller.content.configs.yarn-site')['yarn.timeline-service.leveldb-timeline-store.path']; } return Em.I18n.t('services.reassign.step5.body.' + this.get('controller.content.reassign.component_name').toLowerCase() + ha). http://git-wip-us.apache.org/repos/asf/ambari/blob/cba69d93/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js index a43d91f..7dbf24a 100644 --- a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js +++ b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js @@ -33,7 +33,7 @@ describe('App.ReassignMasterWizardStep1Controller', function () { }); controller.set('_super', Em.K); - describe('#loadConfigTags', function() { + describe('#loadConfigsTags', function() { beforeEach(function() { this.stub = sinon.stub(App.router, 'get'); }); @@ -42,7 +42,7 @@ describe('App.ReassignMasterWizardStep1Controller', function () { this.stub.restore(); }); - it('tests loadConfigTags', function() { + it('tests loadConfigsTags', function() { controller.loadConfigsTags(); var args = testHelpers.findAjaxRequest('name', 'config.tags'); expect(args).exists; @@ -77,8 +77,11 @@ describe('App.ReassignMasterWizardStep1Controller', function () { }); it('tests getDatabaseHost', function() { - controller.set('content.serviceProperties', { - 'javax.jdo.option.ConnectionURL': "jdbc:mysql://c6401/hive?createDatabaseIfNotExist=true" + controller.set('content.configs', { + 'hive-site': { + 'javax.jdo.option.ConnectionURL': 'jdbc:mysql://c6401/hive?createDatabaseIfNotExist=true' + + } }); controller.set('content.reassign.service_id', 'HIVE'); @@ -108,7 +111,8 @@ describe('App.ReassignMasterWizardStep1Controller', function () { sinon.stub(controller, 'getDatabaseHost', Em.K); sinon.stub(controller, 'saveDatabaseType', Em.K); sinon.stub(controller, 'saveServiceProperties', Em.K); - + sinon.stub(controller, 'saveConfigs', Em.K); + reassignCtrl = App.router.reassignMasterController; reassignCtrl.set('content.hasManualSteps', true); }); @@ -117,12 +121,14 @@ describe('App.ReassignMasterWizardStep1Controller', function () { controller.getDatabaseHost.restore(); controller.saveDatabaseType.restore(); controller.saveServiceProperties.restore(); + controller.saveConfigs.restore(); }); it('should not set hasManualSteps to false for oozie with derby db', function() { var data = { items: [ { + type: 'oozie-site', properties: { 'oozie.service.JPAService.jdbc.driver': 'jdbc:derby:${oozie.data.dir}/${oozie.db.schema.name}-db;create=true' } @@ -141,6 +147,7 @@ describe('App.ReassignMasterWizardStep1Controller', function () { var data = { items: [ { + type: 'oozie-site', properties: { 'oozie.service.JPAService.jdbc.driver': 'mysql' }
