AMBARI-8667. oozie setting for oozie.authentication.kerberos.principal should be fixed in Ambari (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/836df671 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/836df671 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/836df671 Branch: refs/heads/trunk Commit: 836df671abc584f70b94a7728e1ebe12bb5f39c4 Parents: f7414a7 Author: Alex Antonenko <hiv...@gmail.com> Authored: Thu Dec 11 20:02:39 2014 +0200 Committer: Alex Antonenko <hiv...@gmail.com> Committed: Thu Dec 11 22:24:44 2014 +0200 ---------------------------------------------------------------------- .../main/admin/security/add/step2.js | 11 +++- .../main/admin/security/add/step2_test.js | 60 ++++++++++++++++++++ 2 files changed, 68 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/836df671/ambari-web/app/controllers/main/admin/security/add/step2.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/security/add/step2.js b/ambari-web/app/controllers/main/admin/security/add/step2.js index 8ccd301..42598b3 100644 --- a/ambari-web/app/controllers/main/admin/security/add/step2.js +++ b/ambari-web/app/controllers/main/admin/security/add/step2.js @@ -339,10 +339,15 @@ App.MainAdminSecurityAddStep2Controller = Em.Controller.extend({ var host = service.configs.findProperty('name', hostConfigName); var principal = service.configs.findProperty('name', principalConfigName); var versionNumber = App.get('currentStackVersionNumber'); - if(principalConfigName == 'storm_principal_name' && stringUtils.compareVersions(versionNumber, "2.2") >= 0){ - principal.defaultValue = defaultPrimaryName; + var special22ConfigsMap = { + storm_principal_name: defaultPrimaryName, + oozie_http_principal_name: defaultPrimaryName + '_HOST' + }; + if (stringUtils.compareVersions(versionNumber, "2.2") >= 0 && special22ConfigsMap[principalConfigName]) { + principal.defaultValue = special22ConfigsMap[principalConfigName]; return true; - } else if (host && principal) { + } + if (host && principal) { var host_defaultValue = Array.isArray(host.defaultValue) ? host.defaultValue[0] : host.defaultValue; principal.defaultValue = defaultPrimaryName + host_defaultValue; return true; http://git-wip-us.apache.org/repos/asf/ambari/blob/836df671/ambari-web/test/controllers/main/admin/security/add/step2_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/security/add/step2_test.js b/ambari-web/test/controllers/main/admin/security/add/step2_test.js index 154d57c..d932392 100644 --- a/ambari-web/test/controllers/main/admin/security/add/step2_test.js +++ b/ambari-web/test/controllers/main/admin/security/add/step2_test.js @@ -385,6 +385,66 @@ describe('App.MainAdminSecurityAddStep2Controller', function () { // expect(controller.get('content.services')[0].configs[0].defaultValue).to.equal('Value1'); expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('name1Value1'); }); + it('stack 2.2 `storm_principal_name` config should be set to `storm`', function() { + sinon.stub(App, 'get').withArgs('currentStackVersionNumber').returns('2.2'); + controller.set('content.services', [ + { + serviceName: 'STORM', + configs: [ + { + name: 'nimbus_host', + defaultValue: 'Value1' + }, + { + name: 'storm_principal_name' + } + ] + } + ]); + controller.setHostToPrincipal('STORM', 'nimbus_host', 'storm_principal_name', 'storm'); + App.get.restore(); + expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('storm'); + }); + it('stack 2.1 `oozie_http_principal_name` value should contains OOZIE_SERVER host', function() { + sinon.stub(App, 'get').withArgs('currentStackVersionNumber').returns('2.1'); + controller.set('content.services', [ + { + serviceName: 'OOZIE', + configs: [ + { + name: 'oozie_servername', + defaultValue: 'host1.com' + }, + { + name: 'oozie_http_principal_name' + } + ] + } + ]); + controller.setHostToPrincipal('OOZIE', 'oozie_servername', 'oozie_http_principal_name', 'HTTP/'); + App.get.restore(); + expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('HTTP/host1.com'); + }); + it('stack 2.2 `oozie_http_principal_name` value should be set to HTTP/_HOST', function() { + sinon.stub(App, 'get').withArgs('currentStackVersionNumber').returns('2.2'); + controller.set('content.services', [ + { + serviceName: 'OOZIE', + configs: [ + { + name: 'oozie_servername', + defaultValue: 'host1.com' + }, + { + name: 'oozie_http_principal_name' + } + ] + } + ]); + controller.setHostToPrincipal('OOZIE', 'oozie_servername', 'oozie_http_principal_name', 'HTTP/'); + App.get.restore(); + expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('HTTP/_HOST'); + }); }); describe('#loadUsers()', function () {