Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 4116c4092 -> ccf9a1c4c


AMBARI-19785. Need to have a flag from UI to show/hide ranger plugin configs. 
(jaimin)


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

Branch: refs/heads/branch-2.5
Commit: ccf9a1c4c19675b83567b9353b5e6f2d5e718f2b
Parents: 4116c40
Author: Jaimin Jetly <[email protected]>
Authored: Tue Jan 31 11:53:48 2017 -0800
Committer: Jaimin Jetly <[email protected]>
Committed: Tue Jan 31 11:54:38 2017 -0800

----------------------------------------------------------------------
 .../HDP/2.0.6/configuration/cluster-env.xml     |  6 +++
 .../controllers/main/service/info/configs.js    | 24 +++++++++---
 .../app/controllers/wizard/step7_controller.js  | 41 ++++++++++++++++----
 3 files changed, 59 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ccf9a1c4/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
index 93680bf..3af8f08 100644
--- 
a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
+++ 
b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml
@@ -290,4 +290,10 @@ gpgcheck=0</value>
       <empty-value-valid>true</empty-value-valid>
     </value-attributes>
   </property>
+  <property>
+    <name>enable_external_ranger</name>
+    <value>false</value>
+    <description>Flag to turn on when external setup of External Ranger is 
done.</description>
+    <on-ambari-upgrade add="false"/>
+  </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ccf9a1c4/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js 
b/ambari-web/app/controllers/main/service/info/configs.js
index d2e3a89..59dbe1d 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -515,14 +515,28 @@ App.MainServiceInfoConfigsController = 
Em.Controller.extend(App.AddSecurityConfi
     var selectedService = this.get('stepConfigs').findProperty('serviceName', 
this.get('content.serviceName'));
     this.set('selectedService', selectedService);
     this.checkOverrideProperty(selectedService);
-    /* if (App.Service.find().someProperty('serviceName', 'RANGER')) {
+
+    var isRangerPresent =  App.Service.find().someProperty('serviceName', 
'RANGER');
+    if (isRangerPresent) {
       
App.router.get('mainServiceInfoSummaryController').updateRangerPluginsStatus();
       this.setVisibilityForRangerProperties(selectedService);
+      this.loadConfigRecommendations(null, this._onLoadComplete.bind(this));
+      App.loadTimer.finish('Service Configs Page');
     } else {
-      App.config.removeRangerConfigs(this.get('stepConfigs'));
-    } */
-    this.loadConfigRecommendations(null, this._onLoadComplete.bind(this));
-    App.loadTimer.finish('Service Configs Page');
+      var mainController = App.get('router.mainController');
+      var clusterController = App.get('router.clusterController');
+      var self = this;
+      mainController.isLoading.call(clusterController, 
'clusterEnv').done(function () {
+        var isExternalRangerSetup = 
clusterController.get("clusterEnv")["properties"]["enable_external_ranger"];
+        if (isExternalRangerSetup) {
+          self.setVisibilityForRangerProperties(selectedService);
+        } else {
+          App.config.removeRangerConfigs(self.get('stepConfigs'));
+        }
+        self.loadConfigRecommendations(null, self._onLoadComplete.bind(self));
+        App.loadTimer.finish('Service Configs Page');
+      });
+    }
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/ccf9a1c4/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js 
b/ambari-web/app/controllers/wizard/step7_controller.js
index 59d6d39..02bec52 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -535,13 +535,40 @@ App.WizardStep7Controller = 
Em.Controller.extend(App.ServerValidatorMixin, App.E
     this.set('stepConfigs', serviceConfigs);
     this.checkHostOverrideInstaller();
     this.selectProperService();
-    /* var rangerService = App.StackService.find().findProperty('serviceName', 
'RANGER');
-    if (rangerService && !rangerService.get('isInstalled') && 
!rangerService.get('isSelected')) {
-      App.config.removeRangerConfigs(this.get('stepConfigs'));
-    } */
-    console.timeEnd('applyServicesConfigs execution time: ');
-    console.time('loadConfigRecommendations execution time: ');
-    this.loadConfigRecommendations(null, 
this.completeConfigLoading.bind(this));
+    var isInstallerWizard = (this.get("content.controllerName") === 
'installerController');
+    var self = this;
+    var rangerService = App.StackService.find().findProperty('serviceName', 
'RANGER');
+    var isRangerServiceAbsent =  rangerService && 
!rangerService.get('isInstalled') && !rangerService.get('isSelected');
+    if (isRangerServiceAbsent) {
+      var isExternalRangerSetup;
+      if (isInstallerWizard) {
+        isExternalRangerSetup = 
configs.filterProperty('fileName','cluster-env.xml').findProperty('name','enable_external_ranger');
+        if (Em.isNone(isExternalRangerSetup) || isExternalRangerSetup.value 
!== "true") {
+          App.config.removeRangerConfigs(this.get('stepConfigs'));
+        }
+        console.timeEnd('applyServicesConfigs execution time: ');
+        console.time('loadConfigRecommendations execution time: ');
+        self.loadConfigRecommendations(null, 
self.completeConfigLoading.bind(self));
+      } else {
+        var mainController = App.get('router.mainController');
+        var clusterController = App.get('router.clusterController');
+        mainController.isLoading.call(clusterController, 
'clusterEnv').done(function () {
+          isExternalRangerSetup = 
clusterController.get("clusterEnv")["properties"]["enable_external_ranger"];
+          if (isExternalRangerSetup !== "true") {
+            App.config.removeRangerConfigs(self.get('stepConfigs'));
+          }
+          console.timeEnd('applyServicesConfigs execution time: ');
+          console.time('loadConfigRecommendations execution time: ');
+          self.loadConfigRecommendations(null, 
self.completeConfigLoading.bind(self));
+        });
+      }
+
+    } else {
+      console.timeEnd('applyServicesConfigs execution time: ');
+      console.time('loadConfigRecommendations execution time: ');
+      self.loadConfigRecommendations(null, 
self.completeConfigLoading.bind(self));
+    }
+
   },
 
   /**

Reply via email to