This is an automated email from the ASF dual-hosted git repository. ishanbha pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/trunk by this push: new a8d4829 [AMBARI-23830] Enable Ranger Plugins for supported components if ranger is installed. a8d4829 is described below commit a8d48299aed34e45dc42bc9638e305c7684d32a2 Author: Ishan Bhatt <ishanbhatt.1...@gmail.com> AuthorDate: Fri May 11 18:08:46 2018 -0700 [AMBARI-23830] Enable Ranger Plugins for supported components if ranger is installed. --- .../app/controllers/wizard/step7_controller.js | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index 745c73d..8c52163 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -588,12 +588,17 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E serviceConfigs = this._reconfigureServicesOnNnHa(serviceConfigs); } } + + var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER'); + var isRangerServicePresent = rangerService && (rangerService.get('isInstalled') || rangerService.get('isSelected')); + if(isRangerServicePresent && (this.get('wizardController.name') === 'installerController' || this.get('wizardController.name') === 'addServiceController')) { + this.setRangerPluginsEnabled(serviceConfigs); + } this.set('stepConfigs', serviceConfigs); this.set('stepConfigsCreated', true); this.checkHostOverrideInstaller(); this.selectProperService(); var isInstallerWizard = (this.get("content.controllerName") === 'installerController'); - var rangerService = App.StackService.find().findProperty('serviceName', 'RANGER'); var isRangerServiceAbsent = rangerService && !rangerService.get('isInstalled') && !rangerService.get('isSelected'); if (isRangerServiceAbsent) { var isExternalRangerSetup; @@ -628,6 +633,29 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E }, /** + * Sets the value of ranger-<service_name>-plugin-enabled to "Yes" if ranger authorization / + * is supported for that service. + * @param stepConfigs Object[] + */ + setRangerPluginsEnabled: function(stepConfigs) { + var rangerServiceConfigs = stepConfigs.findProperty('serviceName', 'RANGER').get('configs'); + var services = this.get('selectedServiceNames').filter(service => service != 'RANGER'); + + services.forEach(function(serviceName) { + var pluginEnabledPropertyName = 'ranger-' + serviceName.toLowerCase() + '-plugin-enabled'; + var pluginEnabledProperty = rangerServiceConfigs.findProperty('name', pluginEnabledPropertyName); + //Kafka and Storm plugins need to be enabled only if cluster is kerberized + if (pluginEnabledProperty && (serviceName === 'STORM' || serviceName === 'KAFKA')) { + if (App.get('isKerberosEnabled')) { + Em.set(pluginEnabledProperty, 'value', 'Yes'); + } + } else if (pluginEnabledProperty) { + Em.set(pluginEnabledProperty, 'value', 'Yes'); + } + }); + }, + + /** * * Makes installed service's configs resulting into component actions (add/delete) non editable on Add Service Wizard * @param configs Object[] -- To stop receiving notification emails like this one, please contact ishan...@apache.org.