Repository: ambari Updated Branches: refs/heads/trunk dfe0dfebe -> 19f18f577
AMBARI-11613. With multiple KMS instances, hadoop.security.key.provider.path and dfs.encryption.key.provider.uri are set to an incorrect value. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1208fc53 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1208fc53 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1208fc53 Branch: refs/heads/trunk Commit: 1208fc5385296d89ca4513948ce06147e1f5476f Parents: dfe0dfe Author: Aleksandr Kovalenko <[email protected]> Authored: Tue Jun 2 15:29:38 2015 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Tue Jun 2 18:10:16 2015 +0300 ---------------------------------------------------------------------- ambari-web/app/controllers/main/host/details.js | 7 +- .../test/controllers/main/host/details_test.js | 76 ++++++++++++++++++++ 2 files changed, 78 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1208fc53/ambari-web/app/controllers/main/host/details.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js index 8ebb6d6..144465b 100644 --- a/ambari-web/app/controllers/main/host/details.js +++ b/ambari-web/app/controllers/main/host/details.js @@ -916,11 +916,8 @@ App.MainHostDetailsController = Em.Controller.extend({ } ]; - for (var i = 0; i < rkmsHosts.length; i++) { - rkmsHosts[i] = rkmsHosts[i] + ':' + rkmsPort; - } - coreSiteConfigs.properties['hadoop.security.key.provider.path'] = 'kms://http@' + rkmsHosts.join(',') + '/kms'; - hdfsSiteConfigs.properties['dfs.encryption.key.provider.uri'] = 'kms://http@' + rkmsHosts.join(',') + '/kms'; + coreSiteConfigs.properties['hadoop.security.key.provider.path'] = 'kms://http@' + rkmsHosts.join(';') + ':' + rkmsPort + '/kms'; + hdfsSiteConfigs.properties['dfs.encryption.key.provider.uri'] = 'kms://http@' + rkmsHosts.join(';') + ':' + rkmsPort + '/kms'; this.saveConfigsBatch(groups, 'RANGER_KMS_SERVER', hostToInstall); }, http://git-wip-us.apache.org/repos/asf/ambari/blob/1208fc53/ambari-web/test/controllers/main/host/details_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js index 15f7231..4023a0e 100644 --- a/ambari-web/test/controllers/main/host/details_test.js +++ b/ambari-web/test/controllers/main/host/details_test.js @@ -2564,4 +2564,80 @@ describe('App.MainHostDetailsController', function () { }); }); + + describe('#onLoadRangerConfigs()', function () { + + var cases = [ + { + 'kmsHosts': ['host1'], + 'kmsPort': 'port', + 'title': 'single host', + 'hostToInstall': undefined, + 'result': [ + { + properties: { + 'core-site': {'hadoop.security.key.provider.path': 'kms://http@host1:port/kms'}, + 'hdfs-site': {'dfs.encryption.key.provider.uri': 'kms://http@host1:port/kms'} + }, + properties_attributes: { + 'core-site': undefined, + 'hdfs-site': undefined + } + } + ] + }, + { + 'kmsHosts': ['host1', 'host2'], + 'kmsPort': 'port', + 'title': 'two hosts', + 'hostToInstall': 'host2', + 'result': [ + { + properties: { + 'core-site': {'hadoop.security.key.provider.path': 'kms://http@host1;host2:port/kms'}, + 'hdfs-site': {'dfs.encryption.key.provider.uri': 'kms://http@host1;host2:port/kms'} + }, + properties_attributes: { + 'core-site': undefined, + 'hdfs-site': undefined + } + } + ] + } + ]; + + beforeEach(function () { + sinon.spy(controller, 'saveConfigsBatch') + }); + + afterEach(function () { + controller.saveConfigsBatch.restore(); + }); + + cases.forEach(function (item) { + it(item.title, function () { + controller.set('rangerKMSServerHost', item.hostToInstall); + sinon.stub(controller, 'getRangerKMSServerHosts').returns(item.kmsHosts); + var data = { + items: [ + { + type: 'kms-env', + properties: {'kms_port': item.kmsPort} + }, + { + type: 'core-site', + properties: {} + }, + { + type: 'hdfs-site', + properties: {} + } + ] + }; + controller.onLoadRangerConfigs(data); + expect(controller.saveConfigsBatch.calledWith(item.result, 'RANGER_KMS_SERVER', item.hostToInstall)).to.be.true; + }); + }); + + }); });
