You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/06/17 14:51:54 UTC

ambari git commit: AMBARI-11973. Missing enable HIVE plugin info in Ranger Summary page (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 9ca9a1deb -> 386506ffd


AMBARI-11973. Missing enable HIVE plugin info in Ranger Summary page (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 386506ffdb4327aa9cc38c6493b472b50a257e1b
Parents: 9ca9a1d
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Jun 17 15:48:58 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Jun 17 15:51:33 2015 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/summary.js    | 35 ++++++++++++++------
 .../main/service/info/summary_test.js           | 16 +++++++--
 2 files changed, 38 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/386506ff/ambari-web/app/controllers/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js
index b26183c..cb5fe4c 100644
--- a/ambari-web/app/controllers/main/service/info/summary.js
+++ b/ambari-web/app/controllers/main/service/info/summary.js
@@ -52,27 +52,38 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
     {
       serviceName: 'HDFS',
       type: 'ranger-hdfs-plugin-properties',
-      propertyName: 'ranger-hdfs-plugin-enabled'
+      propertyName: 'ranger-hdfs-plugin-enabled',
+      valueForEnable: 'Yes'
     },
     {
       serviceName: 'HBASE',
       type: 'ranger-hbase-plugin-properties',
-      propertyName: 'ranger-hbase-plugin-enabled'
+      propertyName: 'ranger-hbase-plugin-enabled',
+      valueForEnable: 'Yes'
+    },
+    {
+      serviceName: 'HIVE',
+      type: 'hive-env',
+      propertyName: 'hive_security_authorization',
+      valueForEnable: 'Ranger'
     },
     {
       serviceName: 'KNOX',
       type: 'ranger-knox-plugin-properties',
-      propertyName: 'ranger-knox-plugin-enabled'
+      propertyName: 'ranger-knox-plugin-enabled',
+      valueForEnable: 'Yes'
     },
     {
       serviceName: 'STORM',
       type: 'ranger-storm-plugin-properties',
-      propertyName: 'ranger-storm-plugin-enabled'
+      propertyName: 'ranger-storm-plugin-enabled',
+      valueForEnable: 'Yes'
     },
     {
       serviceName: 'YARN',
       type: 'ranger-yarn-plugin-properties',
-      propertyName: 'ranger-yarn-plugin-enabled'
+      propertyName: 'ranger-yarn-plugin-enabled',
+      valueForEnable: 'Yes'
     }
   ],
 
@@ -163,11 +174,15 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
     data.items.forEach(function (item) {
       var serviceName = this.get('rangerPlugins').findProperty('type', item.type).serviceName;
       var propertyName = this.get('rangerPlugins').findProperty('type', item.type).propertyName;
-      var statusMap = {
-        Yes: 'alerts.table.state.enabled',
-        No: 'alerts.table.state.disabled'
-      };
-      var statusString = statusMap[item.properties[propertyName]] || 'common.unknown';
+      var propertyValue = this.get('rangerPlugins').findProperty('type', item.type).valueForEnable;
+      var statusString;
+
+      if (item.properties[propertyName]) {
+        statusString = item.properties[propertyName] == propertyValue ? 'alerts.table.state.enabled' : 'alerts.table.state.disabled';
+      }
+      else {
+        statusString = 'common.unknown';
+      }
       Em.set(this.get('rangerPlugins').findProperty('serviceName', serviceName), 'status', Em.I18n.t(statusString));
     }, this);
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/386506ff/ambari-web/test/controllers/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/summary_test.js b/ambari-web/test/controllers/main/service/info/summary_test.js
index a250d33..b42175b 100644
--- a/ambari-web/test/controllers/main/service/info/summary_test.js
+++ b/ambari-web/test/controllers/main/service/info/summary_test.js
@@ -63,6 +63,9 @@ describe('App.MainServiceInfoSummaryController', function () {
         }),
         Em.Object.create({
           serviceName: 'YARN'
+        }),
+        Em.Object.create({
+          serviceName: 'HIVE'
         })
       ]);
       sinon.stub(App.StackService, 'find').returns([
@@ -77,7 +80,7 @@ describe('App.MainServiceInfoSummaryController', function () {
           serviceName: 'HIVE',
           displayName: 'Hive',
           configTypes: {
-            'ranger-hive-plugin-properties': {}
+            'hive-env': {}
           }
         }),
         Em.Object.create({
@@ -119,7 +122,7 @@ describe('App.MainServiceInfoSummaryController', function () {
         controller.set('isRangerPluginsArraySet', item.isRangerPluginsArraySet);
         App.set('router.clusterController.isLoaded', item.isLoaded);
         expect(controller.get('isRangerPluginsArraySet')).to.equal(item.expectedIsRangerPluginsArraySet);
-        expect(controller.get('rangerPlugins').filterProperty('isDisplayed').mapProperty('serviceName').sort()).to.eql(['HDFS']);
+        expect(controller.get('rangerPlugins').filterProperty('isDisplayed').mapProperty('serviceName').sort()).to.eql(['HDFS', 'HIVE']);
       });
     });
 
@@ -133,7 +136,7 @@ describe('App.MainServiceInfoSummaryController', function () {
             'ranger-hdfs-plugin-properties': {
               'tag': 'version1'
             },
-            'ranger-hive-plugin-properties': {
+            'hive-env': {
               'tag': 'version2'
             },
             'ranger-hbase-plugin-properties': {
@@ -223,6 +226,12 @@ describe('App.MainServiceInfoSummaryController', function () {
             }
           },
           {
+            'type': 'hive-env',
+            'properties': {
+              'hive_security_authorization': 'Ranger'
+            }
+          },
+          {
             'type': 'ranger-hbase-plugin-properties',
             'properties': {
               'ranger-hbase-plugin-enabled': ''
@@ -232,6 +241,7 @@ describe('App.MainServiceInfoSummaryController', function () {
       });
       expect(controller.get('isPreviousRangerConfigsCallFailed')).to.be.false;
       expect(controller.get('rangerPlugins').findProperty('serviceName', 'HDFS').status).to.equal(Em.I18n.t('alerts.table.state.enabled'));
+      expect(controller.get('rangerPlugins').findProperty('serviceName', 'HIVE').status).to.equal(Em.I18n.t('alerts.table.state.enabled'));
       expect(controller.get('rangerPlugins').findProperty('serviceName', 'HBASE').status).to.equal(Em.I18n.t('common.unknown'));
     });
   });