ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject [1/2] ambari git commit: AMBARI-16431 Broken labels for kerberos identities.(ababiichuk)
Date Tue, 10 May 2016 15:25:41 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk cb932038e -> c7ed0f81d


AMBARI-16431 Broken labels for kerberos identities.(ababiichuk)


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

Branch: refs/heads/trunk
Commit: c7ed0f81d34c2e924166d0d4bf37ec2bc2b22476
Parents: a3f3a74
Author: ababiichuk <ababiichuk@hortonworks.com>
Authored: Tue May 10 16:48:26 2016 +0300
Committer: ababiichuk <ababiichuk@hortonworks.com>
Committed: Tue May 10 18:25:21 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/data/HDP2/kerberos_identities.js | 115 +++++++++++++++++++
 ambari-web/app/data/HDP2/site_properties.js     |  85 --------------
 .../app/mixins/wizard/addSecurityConfigs.js     |   7 +-
 ambari-web/app/utils/config.js                  |  11 ++
 .../mixins/wizard/addSeccurityConfigs_test.js   |  23 ++++
 5 files changed, 154 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/c7ed0f81/ambari-web/app/data/HDP2/kerberos_identities.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/kerberos_identities.js b/ambari-web/app/data/HDP2/kerberos_identities.js
new file mode 100644
index 0000000..be0b826
--- /dev/null
+++ b/ambari-web/app/data/HDP2/kerberos_identities.js
@@ -0,0 +1,115 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var App = require('app');
+
+module.exports = {
+  configProperties: [
+    {
+      "name": "smokeuser_principal_name",
+      "displayName": "Smoke user principal",
+      "category": "Ambari Principals",
+      "filename": "cluster-env.xml",
+      "index": 1
+    },
+    {
+      "name": "smokeuser_keytab",
+      "displayName": "Smoke user keytab",
+      "category": "Ambari Principals",
+      "filename": "cluster-env.xml",
+      "index": 2
+    },
+    {
+      "name": "ambari-server_keytab",
+      "displayName": "Ambari Keytab",
+      "category": "Ambari Principals",
+      "filename": "cluster-env.xml",
+      "index": 3
+    },
+    {
+      "name": "hdfs_principal_name",
+      "displayName": "HDFS user principal",
+      "category": "Ambari Principals",
+      "filename": "hadoop-env.xml",
+      "index": 4
+    },
+    {
+      "name": "hdfs_user_keytab",
+      "displayName": "HDFS user keytab",
+      "category": "Ambari Principals",
+      "filename": "hadoop-env.xml",
+      "index": 5
+    },
+    {
+      "name": "hbase_principal_name",
+      "displayName": "HBase user principal",
+      "category": "Ambari Principals",
+      "filename": "hbase-env.xml",
+      "index": 6
+    },
+    {
+      "name": "hbase_user_keytab",
+      "displayName": "HBase user keytab",
+      "category": "Ambari Principals",
+      "filename": "hbase-env.xml",
+      "index": 7
+    },
+    {
+      "name": "accumulo_principal_name",
+      "displayName": "Accumulo user principal",
+      "category": "Ambari Principals",
+      "filename": "accumulo-env.xml",
+      "index": 8
+    },
+    {
+      "name": "accumulo_user_keytab",
+      "displayName": "Accumulo user keytab",
+      "category": "Ambari Principals",
+      "filename": "accumulo-env.xml",
+      "index": 9
+    },
+    {
+      "name": "spark.history.kerberos.principal",
+      "displayName": "Spark user principal",
+      "category": "Ambari Principals",
+      "filename": "spark-env.xml",
+      "index": 10
+    },
+    {
+      "name": "spark.history.kerberos.keytab",
+      "displayName": "Spark user keytab",
+      "category": "Ambari Principals",
+      "filename": "spark-env.xml",
+      "index": 11
+    },
+    {
+      "name": "storm_principal_name",
+      "displayName": "Storm user principal",
+      "category": "Ambari Principals",
+      "filename": "storm-env.xml",
+      "index": 12
+    },
+    {
+      "name": "storm_keytab",
+      "displayName": "Storm user keytab",
+      "category": "Ambari Principals",
+      "filename": "storm-env.xml",
+      "index": 13
+    }
+  ]
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7ed0f81/ambari-web/app/data/HDP2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/site_properties.js b/ambari-web/app/data/HDP2/site_properties.js
index 3a0354c..024118f 100644
--- a/ambari-web/app/data/HDP2/site_properties.js
+++ b/ambari-web/app/data/HDP2/site_properties.js
@@ -1789,91 +1789,6 @@ var hdp2properties = [
     "category": "MetricCollector",
     "index": 3
   },
-/************************************************Kerberos Descriptor******************************************/
-  {
-    "name": "smokeuser_principal_name",
-    "displayName": "Smoke user principal",
-    "category": "Ambari Principals",
-    "filename": "cluster-env.xml",
-    "index": 1
-  },
-  {
-    "name": "smokeuser_keytab",
-    "displayName": "Smoke user keytab",
-    "category": "Ambari Principals",
-    "filename": "cluster-env.xml",
-    "index": 2
-  },
-  {
-    "name": "hdfs_principal_name",
-    "displayName": "HDFS user principal",
-    "category": "Ambari Principals",
-    "filename": "hadoop-env.xml",
-    "index": 3
-  },
-  {
-    "name": "hdfs_user_keytab",
-    "displayName": "HDFS user keytab",
-    "category": "Ambari Principals",
-    "filename": "hadoop-env.xml",
-    "index": 4
-  },
-  {
-    "name": "hbase_principal_name",
-    "displayName": "HBase user principal",
-    "category": "Ambari Principals",
-    "filename": "hbase-env.xml",
-    "index": 5
-  },
-  {
-    "name": "hbase_user_keytab",
-    "displayName": "HBase user keytab",
-    "category": "Ambari Principals",
-    "filename": "hbase-env.xml",
-    "index": 6
-  },
-  {
-    "name": "accumulo_principal_name",
-    "displayName": "Accumulo user principal",
-    "category": "Ambari Principals",
-    "filename": "accumulo-env.xml",
-    "index": 7
-  },
-  {
-    "name": "accumulo_user_keytab",
-    "displayName": "Accumulo user keytab",
-    "category": "Ambari Principals",
-    "filename": "accumulo-env.xml",
-    "index": 8
-  },
-  {
-    "name": "spark.history.kerberos.principal",
-    "displayName": "Spark user principal",
-    "category": "Ambari Principals",
-    "filename": "spark-env.xml",
-    "index": 9
-  },
-  {
-    "name": "spark.history.kerberos.keytab",
-    "displayName": "Spark user keytab",
-    "category": "Ambari Principals",
-    "filename": "spark-env.xml",
-    "index": 10
-  },
-  {
-    "name": "storm_principal_name",
-    "displayName": "Storm user principal",
-    "category": "Ambari Principals",
-    "filename": "storm-env.xml",
-    "index": 11
-  },
-  {
-    "name": "storm_keytab",
-    "displayName": "Storm user keytab",
-    "category": "Ambari Principals",
-    "filename": "storm-env.xml",
-    "index": 12
-  },
 /************************************************LOGSEARCH******************************************/
   /*logfeeder-properties*/
   {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7ed0f81/ambari-web/app/mixins/wizard/addSecurityConfigs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
index 09fa561..988272d 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -194,8 +194,11 @@ App.AddSecurityConfigs = Em.Mixin.create({
    * @method _getDisplayNameForConfig
    * @private
    */
-  _getDisplayNameForConfig: function(name, fileName) {
-    return fileName == 'cluster-env' ? App.format.normalizeName(name) : name;
+  _getDisplayNameForConfig: function (name, fileName) {
+    var predefinedConfig = App.config.get('kerberosIdentitiesMap')[App.config.configId(name,
fileName)];
+    return (predefinedConfig && predefinedConfig.displayName)
+      ? predefinedConfig.displayName
+      : fileName == 'cluster-env' ? App.format.normalizeName(name) : name;
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7ed0f81/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 2bc5273..d285c37 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -140,6 +140,17 @@ App.config = Em.Object.create({
     return ret;
   }.property('secureConfigs.[]'),
 
+  kerberosIdentities: require('data/HDP2/kerberos_identities').configProperties,
+
+  kerberosIdentitiesMap: function() {
+    var map = {};
+
+    this.get('kerberosIdentities').forEach(function (c) {
+      map[this.configId(c.name, c.filename)] = c;
+    }, this);
+    return map;
+  }.property('kerberosIdentities'),
+
   customStackMapping: require('data/custom_stack_map'),
 
   mapCustomStack: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/c7ed0f81/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js b/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
index ea44dcf..0ed261a 100644
--- a/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
+++ b/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
@@ -292,6 +292,20 @@ describe('App.AddSecurityConfigs', function () {
 
   describe('#_getDisplayNameForConfig', function () {
 
+    var configIdentitiesMap = {
+      'otherCoolName__some-site': {
+        displayName: 'otherCoolDisplayName'
+      }
+    };
+
+    beforeEach(function() {
+      sinon.stub(App.config, 'get').withArgs('kerberosIdentitiesMap').returns(configIdentitiesMap)
+    });
+
+    afterEach(function() {
+      App.config.get.restore();
+    });
+
     it('config from `cluster-env`', function () {
       var config = {
         fileName: 'cluster-env',
@@ -300,6 +314,15 @@ describe('App.AddSecurityConfigs', function () {
       var displayName = controller._getDisplayNameForConfig(config.name, config.fileName);
       expect(displayName).to.equal(App.format.normalizeName(config.name));
     });
+
+    it('config from UI', function () {
+      var config = {
+        fileName: 'some-site',
+        name: 'otherCoolName'
+      };
+      var displayName = controller._getDisplayNameForConfig(config.name, config.fileName);
+      expect(displayName).to.equal('otherCoolDisplayName');
+    });
   });
 
 });


Mime
View raw message