You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2015/06/18 15:48:31 UTC
[1/4] ambari git commit: AMBARI-11995 Remove add security wizard from
Ambari. (ababiichuk)
Repository: ambari
Updated Branches:
refs/heads/trunk 59a74cfda -> c61933d87
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/add/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/step3_test.js b/ambari-web/test/controllers/main/admin/security/add/step3_test.js
deleted file mode 100644
index 8324fda..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/step3_test.js
+++ /dev/null
@@ -1,560 +0,0 @@
-/**
- * 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');
-
-require('controllers/main/admin/security/add/step3');
-var stringUtils = require('utils/string_utils');
-var modelSetup = require('test/init_model_test');
-
-describe('App.MainAdminSecurityAddStep3Controller', function () {
-
- var controller = App.MainAdminSecurityAddStep3Controller.create({
- content: {}
- });
-
- describe('#openInfoInNewTab()', function() {
- it('Correct data', function() {
- var mock = {
- document: {
- write: function(){}
- },
- focus: function(){}
- };
- sinon.stub(window, 'open', function () {
- return mock;
- });
- sinon.stub(stringUtils, 'arrayToCSV', function () {
- return 'CSV_CONTENT';
- });
- sinon.spy(mock.document, 'write');
- sinon.spy(mock, 'focus');
- controller.set('hostComponents', ['comp1']);
-
- controller.openInfoInNewTab();
- expect(window.open.calledWith('')).to.be.true;
- expect(stringUtils.arrayToCSV.calledWith(['comp1'])).to.be.true;
- expect(mock.document.write.calledWith('CSV_CONTENT')).to.be.true;
- expect(mock.focus.calledOnce).to.be.true;
- window.open.restore();
- stringUtils.arrayToCSV.restore();
- });
- });
-
- describe('#loadStep()', function() {
-
- beforeEach(function(){
- sinon.stub(controller, 'getSecurityUsers', function () {
- return [{
- name: 'user_group',
- value: 'value1'
- }];
- });
- });
- afterEach(function(){
- controller.getSecurityUsers.restore();
- });
-
- it('No hosts installed', function() {
- controller.set('hosts', []);
- controller.loadStep();
- expect(controller.get('hostComponents')).to.be.empty;
- });
- it('One host installed', function () {
- controller.set('hosts', [Em.Object.create({hostName: 'host1'})]);
- sinon.stub(controller, 'setMandatoryConfigs', function (result) {
- return result.push('setMandatoryConfigs');
- });
- sinon.stub(controller, 'setComponentsConfig', function (result) {
- return result.push('setComponentsConfig');
- });
- sinon.stub(controller, 'setHostComponentsSecureValue', function (result) {
- return result.push('setHostComponentsSecureValue');
- });
-
- controller.loadStep();
- expect(controller.setMandatoryConfigs.calledOnce).to.be.true;
- expect(controller.setComponentsConfig.calledOnce).to.be.true;
- expect(controller.setHostComponentsSecureValue.calledOnce).to.be.true;
- expect(controller.get('hostComponents')).to.eql(["setMandatoryConfigs", "setComponentsConfig", "setHostComponentsSecureValue"]);
-
- controller.setMandatoryConfigs.restore();
- controller.setComponentsConfig.restore();
- controller.setHostComponentsSecureValue.restore();
- });
- });
-
- describe('#buildComponentToOwnerMap()', function() {
- beforeEach(function(){
- sinon.stub(controller, 'getSecurityUsers', function () {
- return [{
- name: 'storm_user',
- value: 'storm'
- }];
- });
- });
- afterEach(function(){
- controller.getSecurityUsers.restore();
- });
-
- it('componentToUserMap is empty', function() {
- sinon.stub(controller, 'get').withArgs('componentToUserMap').returns({});
- expect(controller.buildComponentToOwnerMap([])).to.eql({});
- controller.get.restore();
- });
- it('componentToUserMap has properties', function() {
- var securityUsers = [{
- name: 'config1',
- value: 'value1'
- }];
- sinon.stub(controller, 'get').withArgs('componentToUserMap').returns({'COMP1': 'config1'});
- expect(controller.buildComponentToOwnerMap(securityUsers)).to.eql({'COMP1': 'value1'});
- controller.get.restore();
- });
- });
-
- describe('#setComponentsConfig()', function() {
-
- beforeEach(function(){
- modelSetup.setupStackServiceComponent();
- controller.set('content.serviceConfigProperties', [
- {
- serviceName: 'HDFS',
- name: 'principal1',
- value: '_HOST'
- },
- {
- serviceName: 'HDFS',
- name: 'keytab1',
- value: 'value1'
- }
- ]);
- });
-
- afterEach(function() {
- modelSetup.cleanStackServiceComponent();
- });
-
- it('componentToConfigMap is empty', function() {
- controller.reopen({
- componentToConfigMap: []
- });
- var result = [];
- controller.setComponentsConfig(result, Em.Object.create({hostName: 'c6401',hostComponents: []}), 'hadoopGroupId');
- expect(result).to.be.empty;
- });
- it('when component from stack2', function() {
- sinon.stub(App, 'get', function () {
- return true;
- });
- controller.reopen({
- componentToConfigMap: [{
- componentName: 'DATANODE',
- principal: 'principal1',
- keytab: 'keytab1',
- displayName: 'displayName1'
- }]
- });
- var host = Em.Object.create({
- hostComponents: [{componentName: 'DATANODE'}],
- hostName: 'host1'
- });
- var result = [];
- controller.setComponentsConfig(result, host, 'hadoopGroupId');
- expect(result.length).to.equal(1);
- App.get.restore();
- });
- it('Component does not match host-component', function() {
- controller.reopen({
- componentToConfigMap: [{
- componentName: 'DATANODE',
- principal: 'principal1',
- keytab: 'keytab1',
- displayName: 'displayName1'
- }]
- });
- var host = Em.Object.create({
- hostComponents: [{componentName: 'DATANODE1'}],
- hostName: 'host1'
- });
- var result = [];
- controller.setComponentsConfig(result, host, 'hadoopGroupId');
- expect(result).to.be.empty;
- });
- it('Component matches host-component', function() {
- controller.reopen({
- componentToConfigMap: [{
- componentName: 'DATANODE',
- principal: 'principal1',
- keytab: 'keytab1',
- displayName: 'displayName1'
- }]
- });
- var host = Em.Object.create({
- hostComponents: [{componentName: 'DATANODE'}],
- hostName: 'host1'
- });
- var result = [];
- controller.setComponentsConfig(result, host, 'hadoopGroupId');
- expect(result.length).to.equal(1);
- });
- });
-
- describe('#setMandatoryConfigs()', function() {
-
- beforeEach(function () {
- sinon.stub(App.Service, 'find', function () {
- return [
- {serviceName: 'SERVICE1'}
- ];
- });
- controller.set('content.serviceConfigProperties', [
- {
- serviceName: 'GENERAL',
- name: 'kerberos_domain',
- value: 'realm1'
- }
- ]);
- });
- afterEach(function () {
- App.Service.find.restore();
- });
-
- it('mandatoryConfigs is empty', function() {
- var result = [];
- controller.set('mandatoryConfigs', []);
-
- controller.setMandatoryConfigs(result, [], '', '');
- expect(result).to.be.empty;
- });
- it('config has unknown service to check', function() {
- var result = [];
- controller.set('mandatoryConfigs', [{
- userConfig: 'kerberos_domain',
- keytab: 'kerberos_domain',
- displayName: '',
- checkService: 'HBASE'
- }]);
-
- controller.setMandatoryConfigs(result, [], '', '');
- expect(result).to.be.empty;
- });
- it('config should be added', function() {
- var result = [];
- controller.set('mandatoryConfigs', [{
- userConfig: 'userConfig1',
- keytab: 'kerberos_domain',
- displayName: ''
- }]);
- var securityUsers = [{
- name: 'userConfig1',
- value: 'value1'
- }];
-
- controller.setMandatoryConfigs(result, securityUsers, '', '');
- expect(result.length).to.equal(1);
- });
- });
-
- describe('#setHostComponentsSecureValue()', function() {
-
- beforeEach(function () {
- sinon.stub(controller, 'buildComponentToOwnerMap', Em.K);
- sinon.stub(controller, 'changeDisplayName', Em.K);
- sinon.stub(controller, 'getSecureProperties', function(){
- return {principal: '', keytab: ''};
- });
- });
- afterEach(function () {
- controller.buildComponentToOwnerMap.restore();
- controller.changeDisplayName.restore();
- controller.getSecureProperties.restore();
- });
-
- it('host.hostComponents is empty', function() {
- var result = [];
- var host = Em.Object.create({
- hostComponents: []
- });
-
- controller.setHostComponentsSecureValue(result, host);
- expect(result).to.be.empty;
- });
- it('host-component does not match component to display', function() {
- var result = [];
- var host = Em.Object.create({
- hostComponents: [Em.Object.create({
- componentName: 'UNKNOWN'
- })]
- });
-
- controller.setHostComponentsSecureValue(result, host);
- expect(result).to.be.empty;
- });
- it('host-component matches component to display', function() {
- var result = [];
- var host = Em.Object.create({
- hostComponents: [Em.Object.create({
- componentName: 'DATANODE'
- })]
- });
-
- controller.setHostComponentsSecureValue(result, host, {}, [], '');
- expect(result.length).to.equal(1);
- });
- it('addedPrincipalsHost already contain such config', function() {
- var result = [];
- var host = Em.Object.create({
- hostName: 'host1',
- hostComponents: [Em.Object.create({
- componentName: 'DATANODE'
- })]
- });
-
- controller.setHostComponentsSecureValue(result, host, {'host1--': true}, [], '');
- expect(result.length).to.be.empty;
- });
- });
-
- describe('#setHostComponentsSecureValue()', function () {
-
- it('DRPC Server principal should point to Nimbus host for HDP-2.2 stack', function () {
- sinon.stub(App, 'get').withArgs('isHadoop22Stack').returns(true);
- sinon.stub(controller, 'get').withArgs('content.serviceConfigProperties').returns([]);
- sinon.stub(controller, 'getNimbusHostName').returns('nimbus_host');
- sinon.stub(controller, 'buildComponentToOwnerMap').returns({'DRPC_SERVER': 'storm'});
- sinon.stub(controller, 'getSecureProperties').returns({
- "keytab": "/etc/security/keytabs/nimbus.service.keytab",
- "principal": "nimbus/nimbus_host"
- });
- sinon.stub(controller, 'getSecurityUsers', function () {
- return [
- {
- name: 'storm_user',
- value: 'storm'
- }
- ];
- });
- var host = Em.Object.create({
- hostComponents: [Em.Object.create({
- componentName: 'DRPC_SERVER',
- displayName: 'DRPC Server'
- })]
- });
-
- var result = [];
- controller.setHostComponentsSecureValue(result, host, {}, [], 'hadoopId');
- expect(result).to.be.not.empty;
- expect(controller.getSecureProperties.args[0][2]).to.equal('nimbus_host');
-
- var hostComponent = result[0];
- expect(hostComponent.principal).to.equal('nimbus/nimbus_host');
- expect(hostComponent.owner).to.equal('storm');
-
- App.get.restore();
- controller.get.restore();
- controller.getNimbusHostName.restore();
- controller.buildComponentToOwnerMap.restore();
- controller.getSecureProperties.restore();
- controller.getSecurityUsers.restore();
- });
- });
-
- describe('#getSecureProperties()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'getPrincipal', function () {
- return 'principal';
- });
- });
- afterEach(function () {
- controller.getPrincipal.restore();
- });
-
- var testCases = [
- {
- title: 'serviceConfigs is empty',
- content: {
- serviceConfigs: [],
- componentName: ''
- },
- result: {}
- },
- {
- title: 'Config has component that does not match component name',
- content: {
- serviceConfigs: [{
- component: 'comp1'
- }],
- componentName: 'comp2'
- },
- result: {}
- },
- {
- title: 'Config has components that does not match component name',
- content: {
- serviceConfigs: [{
- components: ['comp1']
- }],
- componentName: 'comp2'
- },
- result: {}
- },
- {
- title: 'Config has component that matches component name',
- content: {
- serviceConfigs: [{
- name: 'C_principal_name',
- component: 'comp1',
- value: 'value1'
- }],
- componentName: 'comp1'
- },
- result: {
- principal: 'principal'
- }
- },
- {
- title: 'Config has components that matches component name',
- content: {
- serviceConfigs: [{
- name: 'C_principal_name',
- components: ['comp1'],
- value: 'value1'
- }],
- componentName: 'comp1'
- },
- result: {
- principal: 'principal'
- }
- },
- {
- title: 'Config name without correct postfix',
- content: {
- serviceConfigs: [{
- name: 'config1',
- component: 'comp1',
- value: 'value1'
- }],
- componentName: 'comp1'
- },
- result: {}
- },
- {
- title: 'Config name with "_keytab" postfix',
- content: {
- serviceConfigs: [{
- name: 'c_keytab',
- component: 'comp1',
- value: 'value1'
- }],
- componentName: 'comp1'
- },
- result: {
- keytab: 'value1'
- }
- },
- {
- title: 'Config name with "_keytab_path" postfix',
- content: {
- serviceConfigs: [{
- name: 'c_keytab_path',
- component: 'comp1',
- value: 'value1'
- }],
- componentName: 'comp1'
- },
- result: {
- keytab: 'value1'
- }
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- expect(controller.getSecureProperties(test.content.serviceConfigs, test.content.componentName, '')).to.eql(test.result);
- });
- });
- });
-
- describe('#getPrincipal()', function () {
-
- var testCases = [
- {
- title: 'Config value missing "_HOST" string, unit is empty',
- content: {
- config: {
- value: 'value1',
- unit: ''
- },
- hostName: ''
- },
- result: 'value1'
- },
- {
- title: 'Config value missing "_HOST" string, unit is correct',
- content: {
- config: {
- value: 'value1',
- unit: 'unit1'
- },
- hostName: ''
- },
- result: 'value1unit1'
- },
- {
- title: 'Config value contains "_HOST" string, host name in lowercase',
- content: {
- config: {
- value: '_HOST',
- unit: 'unit1'
- },
- hostName: 'host1'
- },
- result: 'host1unit1'
- },
- {
- title: 'Config value contains "_HOST" string, host name in uppercase',
- content: {
- config: {
- value: '_HOST',
- unit: 'unit1'
- },
- hostName: 'HOST1'
- },
- result: 'host1unit1'
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- expect(controller.getPrincipal(test.content.config, test.content.hostName)).to.equal(test.result);
- });
- });
- });
-
- describe('#changeDisplayName()', function() {
- it('name is HiveServer2', function() {
- expect(controller.changeDisplayName('HiveServer2')).to.equal('Hive Metastore and HiveServer2');
- });
- it('name is not HiveServer2', function() {
- expect(controller.changeDisplayName('something')).to.equal('something');
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/add/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/step4_test.js b/ambari-web/test/controllers/main/admin/security/add/step4_test.js
deleted file mode 100644
index bdc6e10..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/step4_test.js
+++ /dev/null
@@ -1,484 +0,0 @@
-/**
- * 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');
-require('controllers/main/admin/security/security_progress_controller');
-require('controllers/main/admin/security/add/step4');
-require('mixins/wizard/addSecurityConfigs');
-require('utils/polling');
-require('models/cluster_states');
-require('models/service');
-
-var controller;
-
-describe('App.MainAdminSecurityAddStep4Controller', function () {
-
- beforeEach(function () {
- controller = App.MainAdminSecurityAddStep4Controller.create({
- content: {},
- commands: [],
- enableSubmit: function () {
- this._super()
- },
- secureMapping: [],
- secureProperties: [],
- secureServices: []
- });
- });
-
- describe('#isBackBtnDisabled', function () {
- it('commands have error', function () {
- controller.set('commands', [Em.Object.create({
- isError: true
- })]);
- expect(controller.get('isBackBtnDisabled')).to.be.false;
- });
- it('commands do not have error', function () {
- controller.set('commands', [Em.Object.create({
- isError: false
- })]);
- expect(controller.get('isBackBtnDisabled')).to.be.true;
- });
- });
-
- describe('#isSecurityApplied', function () {
- var testCases = [
- {
- title: 'No START_SERVICES command',
- commands: [],
- result: false
- },
- {
- title: 'START_SERVICES is not success',
- commands: [Em.Object.create({
- name: 'START_SERVICES',
- isSuccess: false
- })],
- result: false
- },
- {
- title: 'START_SERVICES is success',
- commands: [Em.Object.create({
- name: 'START_SERVICES',
- isSuccess: true
- })],
- result: true
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- controller.set('commands', test.commands);
- expect(controller.get('isSecurityApplied')).to.equal(test.result);
- });
- });
- });
-
- describe('#enableSubmit()', function () {
- var mock = {
- setStepsEnable: Em.K,
- setLowerStepsDisable: Em.K
- };
-
- beforeEach(function () {
- sinon.stub(App.router, 'get', function () {
- return mock;
- });
- sinon.spy(mock, 'setStepsEnable');
- sinon.spy(mock, 'setLowerStepsDisable');
- });
- afterEach(function () {
- App.router.get.restore();
- mock.setStepsEnable.restore();
- mock.setLowerStepsDisable.restore();
- });
-
- it('Command has error', function () {
- controller.set('commands', [Em.Object.create({
- isError: true
- })]);
- controller.enableSubmit();
- expect(controller.get('isSubmitDisabled')).to.be.false;
- expect(mock.setStepsEnable.calledOnce).to.be.true;
- });
- it('Command is successful', function () {
- controller.set('commands', [Em.Object.create({
- isSuccess: true
- })]);
- controller.enableSubmit();
- expect(controller.get('isSubmitDisabled')).to.be.false;
- });
- it('Command is in progress', function () {
- controller.set('commands', [Em.Object.create()]);
- controller.enableSubmit();
- expect(controller.get('isSubmitDisabled')).to.be.true;
- expect(mock.setLowerStepsDisable.calledWith(4)).to.be.true;
- });
- });
-
- describe('#clearStep()', function () {
- it('Clear step info', function () {
- controller.set('commands', [Em.Object.create()]);
- controller.set('isSubmitDisabled', false);
- controller.set('serviceConfigTags', [
- {}
- ]);
- controller.clearStep();
- expect(controller.get('isSubmitDisabled')).to.be.true;
- expect(controller.get('commands')).to.be.empty;
- expect(controller.get('serviceConfigTags')).to.be.empty;
- });
- });
-
- describe('#loadCommands()', function () {
-
- before(function () {
- sinon.stub(App.clusterStatus, 'setClusterStatus', Em.K);
- });
-
- after(function () {
- App.clusterStatus.setClusterStatus.restore();
- });
-
- var tests = Em.A([
- {
- doesATSSupportKerberos: true,
- isATSInstalled: true,
- e: {
- l: 3,
- d: false
- }
- },
- {
- doesATSSupportKerberos: true,
- isATSInstalled: false,
- e: {
- l: 3,
- d: false
- }
- },
- {
- doesATSSupportKerberos: false,
- isATSInstalled: true,
- e: {
- l: 4,
- d: true
- }
- },
- {
- doesATSSupportKerberos: false,
- isATSInstalled: false,
- e: {
- l: 3,
- d: false
- }
- }
- ]);
-
- tests.forEach(function (test) {
- it('doesATSSupportKerberos ' + test.doesATSSupportKerberos.toString() + ', isATSInstalled ' + test.isATSInstalled.toString(), function () {
- sinon.stub(App, 'get', function (k) {
- if ('doesATSSupportKerberos' === k) return test.doesATSSupportKerberos;
- return Em.get(App, k);
- });
- controller.set('content.isATSInstalled', test.isATSInstalled);
- controller.loadCommands();
- App.get.restore();
- expect(controller.get('commands.length')).to.equal(test.e.l);
- expect(controller.get('commands').someProperty('name', 'DELETE_ATS')).to.equal(test.e.d);
- });
- });
-
- });
-
- describe('#loadStep()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'clearStep', Em.K);
- sinon.stub(controller, 'prepareSecureConfigs', Em.K);
- });
- afterEach(function () {
- controller.clearStep.restore();
- controller.prepareSecureConfigs.restore();
- controller.resumeSavedCommands.restore();
- });
-
- it('Resume saved commands', function () {
- sinon.stub(controller, 'resumeSavedCommands', function () {
- return true;
- });
-
- controller.loadStep();
- expect(controller.clearStep.calledOnce).to.be.true;
- expect(controller.prepareSecureConfigs.calledOnce).to.be.true;
- expect(controller.resumeSavedCommands.calledOnce).to.be.true;
- });
- it('No saved commands', function () {
- sinon.stub(controller, 'resumeSavedCommands', function () {
- return false;
- });
- sinon.stub(controller, 'loadCommands', Em.K);
- sinon.stub(controller, 'addInfoToCommands', Em.K);
- sinon.stub(controller, 'syncStopServicesOperation', Em.K);
- sinon.stub(controller, 'addObserverToCommands', Em.K);
- sinon.stub(controller, 'moveToNextCommand', Em.K);
-
- controller.loadStep();
- expect(controller.clearStep.calledOnce).to.be.true;
- expect(controller.prepareSecureConfigs.calledOnce).to.be.true;
- expect(controller.resumeSavedCommands.calledOnce).to.be.true;
-
- controller.loadCommands.restore();
- controller.addInfoToCommands.restore();
- controller.syncStopServicesOperation.restore();
- controller.addObserverToCommands.restore();
- controller.moveToNextCommand.restore();
- });
- });
-
- describe('#syncStopServicesOperation()', function () {
-
- afterEach(function () {
- App.router.get.restore();
- });
-
- it('No running operations', function () {
- sinon.stub(App.router, 'get', function () {
- return [];
- });
-
- expect(controller.syncStopServicesOperation()).to.be.false;
- });
- it('Running operation is not Stop All Services', function () {
- sinon.stub(App.router, 'get', function () {
- return [Em.Object.create({isRunning: true})];
- });
-
- expect(controller.syncStopServicesOperation()).to.be.false;
- });
- it('No STOP_SERVICES in commands', function () {
- sinon.stub(App.router, 'get', function () {
- return [Em.Object.create({
- isRunning: true,
- name: 'Stop All Services'
- })];
- });
- controller.set('commands', []);
-
- expect(controller.syncStopServicesOperation()).to.be.false;
- });
- it('Sync stop services commands', function () {
- sinon.stub(App.router, 'get', function () {
- return [Em.Object.create({
- isRunning: true,
- name: 'Stop All Services',
- id: 1
- })];
- });
- controller.set('commands', [Em.Object.create({
- name: 'STOP_SERVICES'
- })]);
-
- expect(controller.syncStopServicesOperation()).to.be.true;
- expect(controller.get('commands').findProperty('name', 'STOP_SERVICES').get('requestId')).to.equal(1);
- });
- });
-
- describe('#resumeSavedCommands()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'addObserverToCommands', Em.K);
- sinon.stub(controller, 'moveToNextCommand', Em.K);
- controller.set('commands', []);
- });
- afterEach(function () {
- controller.moveToNextCommand.restore();
- controller.addObserverToCommands.restore();
- App.db.getSecurityDeployCommands.restore();
- });
-
-
- it('Commands is null', function () {
- sinon.stub(App.db, 'getSecurityDeployCommands', function () {
- return null;
- });
- expect(controller.resumeSavedCommands()).to.be.false;
- });
- it('Commands is empty', function () {
- sinon.stub(App.db, 'getSecurityDeployCommands', function () {
- return [];
- });
- expect(controller.resumeSavedCommands()).to.be.false;
- });
- it('Command has error', function () {
- sinon.stub(App.db, 'getSecurityDeployCommands', function () {
- return [
- {
- isError: true,
- name: 'command1'
- }
- ];
- });
- expect(controller.resumeSavedCommands()).to.be.true;
- expect(controller.get('commands').mapProperty('name')).to.eql(['command1']);
- expect(controller.addObserverToCommands.calledOnce).to.be.true;
- });
- it('Command in progress', function () {
- sinon.stub(App.db, 'getSecurityDeployCommands', function () {
- return [
- {
- isStarted: true,
- isCompleted: false,
- name: 'command1'
- }
- ];
- });
- expect(controller.resumeSavedCommands()).to.be.true;
- expect(controller.get('commands').mapProperty('name')).to.eql(['command1']);
- expect(controller.get('commands').findProperty('name', 'command1').get('isStarted')).to.be.false;
- expect(controller.addObserverToCommands.calledOnce).to.be.true;
- expect(controller.moveToNextCommand.calledOnce).to.be.true;
- });
- it('Command completed', function () {
- sinon.stub(App.db, 'getSecurityDeployCommands', function () {
- return [
- {
- isCompleted: true,
- name: 'command1'
- }
- ];
- });
- expect(controller.resumeSavedCommands()).to.be.true;
- expect(controller.get('commands').mapProperty('name')).to.eql(['command1']);
- expect(controller.addObserverToCommands.calledOnce).to.be.true;
- expect(controller.moveToNextCommand.calledOnce).to.be.true;
- });
- });
-
- describe('#manageSecureConfigs()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'setPrincipalValue', Em.K);
- });
- afterEach(function () {
- controller.setPrincipalValue.restore();
- });
-
- it('serviceConfigTags is null', function () {
- sinon.stub(controller, 'onJsError', Em.K);
- controller.set('serviceConfigTags', null);
- controller.set('configs', [
- {id: 'site property'}
- ]);
- controller.set('commands', [Em.Object.create({
- name: 'APPLY_CONFIGURATIONS'
- })]);
-
- expect(controller.manageSecureConfigs()).to.be.false;
- expect(controller.onJsError.calledOnce).to.be.true;
- expect(controller.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS').get('isSuccess')).to.be.false;
- expect(controller.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS').get('isError')).to.be.true;
-
- controller.onJsError.restore();
- });
- it('Add configs from site-*.xml', function () {
- controller.set('serviceConfigTags', [
- {
- siteName: 'site1',
- configs: {}
- }
- ]);
- controller.set('configs', [
- {
- id: 'site property',
- name: 'config1',
- value: "value1",
- filename: 'site1.xml'
- }
- ]);
-
- expect(controller.manageSecureConfigs()).to.be.true;
- expect(controller.get('serviceConfigTags')[0].configs).to.eql({'config1': 'value1'});
- });
- it('Add configs from global.xml, config matches "_hosts"', function () {
- controller.reopen({
- secureConfigs: [
- {
- serviceName: 'service1',
- name: 'config1'
- }
- ]
- });
-
- controller.set('serviceConfigTags', [
- {
- siteName: 'global',
- configs: {}
- }
- ]);
- controller.set('globalProperties', [
- {
- id: 'site property',
- name: 'config1_hosts',
- value: "value1",
- filename: 'site1.xml'
- }
- ]);
-
- expect(controller.manageSecureConfigs()).to.be.true;
- expect(controller.get('serviceConfigTags')[0].configs).to.eql({});
- expect(controller.setPrincipalValue.calledWith('service1', 'config1')).to.be.true;
- });
- });
-
- describe('#deleteComponents()', function () {
- it('Send ajax', function () {
- sinon.stub(App.ajax, 'send', Em.K);
-
- controller.deleteComponents('comp1', 'host1');
- expect(App.ajax.send.calledOnce).to.be.true;
-
- App.ajax.send.restore();
- });
- });
-
- describe('#onDeleteComplete()', function () {
- it('', function () {
- controller.set('commands', [Em.Object.create({
- name: 'DELETE_ATS'
- })]);
-
- controller.onDeleteComplete();
- expect(controller.get('commands').findProperty('name', 'DELETE_ATS').get('isError')).to.be.false;
- expect(controller.get('commands').findProperty('name', 'DELETE_ATS').get('isSuccess')).to.be.true;
- });
- });
-
- describe('#onJsError()', function () {
- it('Show popup', function () {
- sinon.stub(App.ModalPopup, 'show', Em.K);
-
- controller.onJsError();
- expect(App.ModalPopup.show.calledOnce).to.be.true;
-
- App.ModalPopup.show.restore();
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/disable_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/disable_test.js b/ambari-web/test/controllers/main/admin/security/disable_test.js
deleted file mode 100644
index 82d11d1..0000000
--- a/ambari-web/test/controllers/main/admin/security/disable_test.js
+++ /dev/null
@@ -1,386 +0,0 @@
-/**
- * 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');
-require('controllers/main/admin/security/disable');
-
-
-describe('App.MainAdminSecurityDisableController', function () {
-
- var controller = App.MainAdminSecurityDisableController.create({
- serviceConfigTags: null,
- secureProperties: null,
- secureMapping: null
- });
-
-
- describe('#resumeCommands()', function () {
- var context = {
- getSecurityDeployCommands: function () {
- return this.testData;
- }
- };
-
- var mock = {
- setStepsEnable: Em.K,
- setLowerStepsDisable: Em.K
- };
-
- beforeEach(function () {
- sinon.stub(App.db, "getSecurityDeployCommands", context.getSecurityDeployCommands);
- sinon.stub(App.router, 'get', function () {
- return mock;
- });
- });
- afterEach(function () {
- App.db.getSecurityDeployCommands.restore();
- App.router.get.restore();
- });
-
- it('commands are absent in local storage', function () {
- App.db.testData = null;
- expect(controller.resumeCommands()).to.be.false;
- });
- it('zero commands in local storage', function () {
- App.db.testData = [];
- expect(controller.resumeCommands()).to.be.false;
- });
- it('one command is present', function () {
- App.db.testData = [
- {
- name: 'command1'
- }
- ];
- controller.get('commands').clear();
- expect(controller.resumeCommands()).to.be.true;
- expect(controller.get('commands').mapProperty('name')).to.eql(['command1']);
- });
- it('command is started and completed', function () {
- App.db.testData = [
- {
- name: 'command1',
- isStarted: true,
- isCompleted: true
- }
- ];
- controller.get('commands').clear();
- expect(controller.resumeCommands()).to.be.true;
- expect(controller.get('commands').mapProperty('name')).to.eql(['command1']);
- expect(controller.get('commands').findProperty('name', 'command1').get('isStarted')).to.be.true;
- });
- it('command is started but not completed', function () {
- App.db.testData = [
- {
- name: 'command1',
- isStarted: true,
- isCompleted: false
- }
- ];
- controller.get('commands').clear();
- expect(controller.resumeCommands()).to.be.true;
- expect(controller.get('commands').mapProperty('name')).to.eql(['command1']);
- expect(controller.get('commands').findProperty('name', 'command1').get('isStarted')).to.be.false;
- });
- });
-
- describe('#isSubmitDisabled', function () {
- var testCases = [
- {
- title: 'commands is empty',
- commands: [],
- result: false
- },
- {
- title: 'one started command',
- commands: [Em.Object.create({
- isStarted: true
- })],
- result: true
- },
- {
- title: 'one failed command',
- commands: [Em.Object.create({
- isError: true
- })],
- result: false
- },
- {
- title: 'one success command',
- commands: [Em.Object.create({
- isSuccess: true
- })],
- result: false
- },
- {
- title: 'not all commands are success',
- commands: [
- Em.Object.create({
- isSuccess: true
- }),
- Em.Object.create({
- isSuccess: false
- })
- ],
- result: true
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- controller.set('commands', test.commands);
- expect(controller.get('isSubmitDisabled')).to.equal(test.result);
- });
- });
- });
-
- describe('#syncStopServicesCommand()', function () {
-
- it('No background operations', function () {
- controller.set('commands', [Em.Object.create({
- name: 'STOP_SERVICES',
- requestId: 1
- })]);
- controller.syncStopServicesCommand.apply(controller);
- expect(controller.get('commands').findProperty('name', 'STOP_SERVICES').get('requestId')).to.equal(1);
- });
- it('background operation is not running', function () {
- App.router.set('backgroundOperationsController.services', [
- Em.Object.create({
- isRunning: false
- })
- ]);
- controller.syncStopServicesCommand.apply(controller);
- expect(controller.get('commands').findProperty('name', 'STOP_SERVICES').get('requestId')).to.equal(1);
- });
- it('background operation is running but not "Stop All Services"', function () {
- App.router.set('backgroundOperationsController.services', [
- Em.Object.create({
- isRunning: true
- })
- ]);
- controller.syncStopServicesCommand.apply(controller);
- expect(controller.get('commands').findProperty('name', 'STOP_SERVICES').get('requestId')).to.equal(1);
- });
- it('"Stop All Services" operation is running', function () {
- App.router.set('backgroundOperationsController.services', [
- Em.Object.create({
- name: 'Stop All Services',
- isRunning: true,
- id: 2
- })
- ]);
- controller.syncStopServicesCommand.apply(controller);
- expect(controller.get('commands').findProperty('name', 'STOP_SERVICES').get('requestId')).to.equal(2);
- });
- });
-
- describe('#manageSecureConfigs()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, "modifySiteConfigs", Em.K);
- });
- afterEach(function () {
- controller.modifySiteConfigs.restore();
- });
-
- var testCases = [
- {
- title: 'serviceConfigTags, secureProperties, secureMapping are null',
- content: {
- serviceConfigTags: null,
- secureProperties: null,
- secureMapping: null
- }
- },
- {
- title: 'serviceConfigTags is null',
- content: {
- serviceConfigTags: null,
- secureProperties: [],
- secureMapping: []
- }
- },
- {
- title: 'secureProperties is null',
- content: {
- serviceConfigTags: [],
- secureProperties: null,
- secureMapping: []
- }
- },
- {
- title: 'secureMapping is null',
- content: {
- serviceConfigTags: [],
- secureProperties: [],
- secureMapping: null
- }
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- controller.set('commands', [Em.Object.create({
- name: 'APPLY_CONFIGURATIONS'
- })]);
- controller.set('serviceConfigTags', test.content.serviceConfigTags);
- controller.set('secureProperties', test.content.secureProperties);
- controller.set('secureMapping', test.content.secureMapping);
-
- expect(controller.manageSecureConfigs()).to.be.false;
- expect(controller.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS').get('isSuccess')).to.be.false;
- expect(controller.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS').get('isError')).to.be.true;
- });
- });
- it('serviceConfigTags is empty', function () {
- controller.set('serviceConfigTags', []);
- controller.set('secureProperties', []);
- controller.set('secureMapping', []);
-
- expect(controller.manageSecureConfigs()).to.be.true;
- });
- it('serviceConfigTags has cluster-env site', function () {
- controller.set('serviceConfigTags', [
- {
- siteName: 'cluster-env',
- configs: {}
- }
- ]);
-
- expect(controller.manageSecureConfigs()).to.be.true;
- expect(controller.get('serviceConfigTags').findProperty('siteName', 'cluster-env').configs.security_enabled).to.equal('false');
- });
- it('serviceConfigTags has site.xml', function () {
- controller.set('serviceConfigTags', [
- {
- siteName: 'site'
- }
- ]);
- expect(controller.manageSecureConfigs()).to.be.true;
- expect(controller.modifySiteConfigs.calledOnce).to.be.true;
- });
- });
-
- describe('#modifySiteConfigs()', function () {
- var testCases = [
- {
- title: '_serviceConfigTags and secureMapping are null',
- content: {
- secureMapping: null,
- _serviceConfigTags: null
- },
- result: false
- },
- {
- title: '_serviceConfigTags is null',
- content: {
- secureMapping: [],
- _serviceConfigTags: null
- },
- result: false
- },
- {
- title: 'secureMapping is null',
- content: {
- secureMapping: null,
- _serviceConfigTags: {}
- },
- result: false
- },
- {
- title: 'secureMapping and _serviceConfigTags are empty',
- content: {
- secureMapping: [],
- _serviceConfigTags: {
- configs: {}
- }
- },
- result: true
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- expect(controller.modifySiteConfigs(test.content.secureMapping, test.content._serviceConfigTags)).to.equal(test.result);
- });
- });
- it('secureMapping doesn\'t contain passed siteName', function () {
- var secureMapping = [];
- var _serviceConfigTags = {
- configs: {
- 'config2': true
- },
- siteName: 'site1'
- };
- expect(controller.modifySiteConfigs(secureMapping, _serviceConfigTags)).to.be.true;
- expect(_serviceConfigTags.configs.config2).to.be.true;
- });
- it('secureMapping contain passed siteName but doesn\'t match config name', function () {
- var secureMapping = [
- {
- filename: 'site1.xml'
- }
- ];
- var _serviceConfigTags = {
- configs: {
- 'config2': true
- },
- siteName: 'site1'
- };
- expect(controller.modifySiteConfigs(secureMapping, _serviceConfigTags)).to.be.true;
- expect(_serviceConfigTags.configs.config2).to.be.true;
- });
- it('secureMapping contain passed siteName and match config name', function () {
- var secureMapping = [
- {
- filename: 'site1.xml',
- name: 'config2'
- }
- ];
- var _serviceConfigTags = {
- configs: {
- 'config2': true
- },
- siteName: 'site1'
- };
- expect(controller.modifySiteConfigs(secureMapping, _serviceConfigTags)).to.be.true;
- expect(_serviceConfigTags.configs.config2).to.be.undefined;
- });
- it('secureMapping contain passed siteName and included in secureConfigValuesMap', function () {
- var secureMapping = [
- {
- filename: 'site1.xml',
- name: 'config2',
- nonSecureValue: 'nonSecureValue'
- }
- ];
- var _serviceConfigTags = {
- configs: {
- 'config2': true
- },
- siteName: 'site1'
- };
- controller.set('secureConfigValuesMap', {
- 'config2': 'value'
- });
- expect(controller.modifySiteConfigs(secureMapping, _serviceConfigTags)).to.be.true;
- expect(_serviceConfigTags.configs.config2).to.equal('nonSecureValue');
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/security_progress_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/security_progress_controller_test.js b/ambari-web/test/controllers/main/admin/security/security_progress_controller_test.js
deleted file mode 100644
index 3ad07f7..0000000
--- a/ambari-web/test/controllers/main/admin/security/security_progress_controller_test.js
+++ /dev/null
@@ -1,443 +0,0 @@
-/**
- * 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');
-require('controllers/main/admin/security/security_progress_controller');
-require('models/host_component');
-require('models/host');
-
-describe('App.MainAdminSecurityProgressController', function () {
-
- var controller = App.MainAdminSecurityProgressController.create({
- loadClusterConfigs: function () {},
- deleteComponents: function () {}
- });
-
- describe('#retry()', function () {
-
- beforeEach(function () {
- sinon.spy(controller, "startCommand");
- });
- afterEach(function () {
- controller.startCommand.restore();
- });
-
- it('commands are empty', function () {
- controller.set('commands', []);
- controller.retry();
- expect(controller.startCommand.called).to.be.false;
- });
-
- it('command is successful', function () {
- controller.set('commands', [
- Em.Object.create({
- name: 'test',
- isSuccess: true,
- isError: false,
- isStarted: true
- })
- ]);
- controller.retry();
- expect(controller.startCommand.calledOnce).to.be.false;
- expect(controller.get('commands').findProperty('name', 'test').get('isError')).to.be.false;
- expect(controller.get('commands').findProperty('name', 'test').get('isStarted')).to.be.true;
- });
-
- it('command is failed', function () {
- controller.set('commands', [
- Em.Object.create({
- name: 'test',
- isSuccess: true,
- isError: true,
- isStarted: true
- })
- ]);
- controller.retry();
- expect(controller.startCommand.calledOnce).to.be.true;
- expect(controller.get('commands').findProperty('name', 'test').get('isError')).to.be.false;
- expect(controller.get('commands').findProperty('name', 'test').get('isStarted')).to.be.false;
- });
- });
-
- describe('#updateServices()', function () {
-
- it('commands are empty', function () {
- controller.set('services', [
- {}
- ]);
- controller.set('commands', []);
- controller.updateServices();
- expect(controller.get('services')).to.be.empty;
- });
-
- it('command doesn\'t have polledData', function () {
- controller.set('services', [
- {}
- ]);
- controller.set('commands', [Em.Object.create({
- label: 'label'
- })]);
- controller.updateServices();
- expect(controller.get('services')).to.be.empty;
- });
-
- it('command has polledData', function () {
- controller.set('services', [
- {}
- ]);
- controller.set('commands', [Em.Object.create({
- label: 'service1',
- polledData: [
- {
- Tasks: {
- host_name: 'host1'
- }
- }
- ]
- })]);
- controller.updateServices();
- expect(controller.get('services').findProperty('name', 'service1').get('hosts')).to.eql([
- {
- name: 'host1',
- publicName: 'host1',
- logTasks: [
- {
- Tasks: {host_name: 'host1'}
- }
- ]
- }
- ]);
- });
- });
-
- describe('#setIndex()', function () {
- it('commandArray is empty', function () {
- var commandArray = [];
- controller.setIndex(commandArray);
- expect(commandArray).to.be.empty;
- expect(controller.get('totalSteps')).to.equal(0);
- });
- it('one command in commandArray', function () {
- var commandArray = [
- Em.Object.create({name: 'command1'})
- ];
- controller.setIndex(commandArray);
- expect(commandArray[0].get('index')).to.equal(1);
- expect(controller.get('totalSteps')).to.equal(1);
- });
- it('commands with random indexes', function () {
- var commandArray = [];
- commandArray[3] = Em.Object.create({name: 'command3'});
- commandArray[11] = Em.Object.create({name: 'command11'});
- controller.setIndex(commandArray);
- expect(commandArray[3].get('index')).to.equal(4);
- expect(commandArray[11].get('index')).to.equal(12);
- expect(controller.get('totalSteps')).to.equal(12);
- });
- });
-
- describe('#startCommand()', function () {
-
- var command = Em.Object.create({
- start: Em.K
- });
-
- beforeEach(function () {
- sinon.spy(command, "start");
- sinon.spy(controller, "loadClusterConfigs");
- sinon.spy(controller, "deleteComponents");
- sinon.stub(controller, "saveCommands", Em.K);
- });
-
- afterEach(function () {
- command.start.restore();
- controller.loadClusterConfigs.restore();
- controller.deleteComponents.restore();
- controller.saveCommands.restore();
- });
-
- it('number of commands doesn\'t match totalSteps', function () {
- controller.set('commands', []);
- controller.set('totalSteps', 1);
- expect(controller.startCommand()).to.be.false;
- });
-
- it('commands is empty', function () {
- controller.set('commands', []);
- controller.set('totalSteps', 0);
- expect(controller.startCommand()).to.be.false;
- });
-
- it('command is started and completed', function () {
- controller.set('commands', [Em.Object.create({
- isStarted: true,
- isCompleted: true
- })]);
- controller.set('totalSteps', 1);
- expect(controller.startCommand()).to.be.false;
- });
-
- it('command is started and incompleted', function () {
- controller.set('commands', [Em.Object.create({
- isStarted: true,
- isCompleted: false
- })]);
- controller.set('totalSteps', 1);
- expect(controller.startCommand()).to.be.true;
- });
-
- it('command parameter passed, isPolling is true', function () {
- controller.set('commands', []);
- controller.set('totalSteps', 0);
- command.set('isPolling', true);
- expect(controller.startCommand(command)).to.be.true;
- expect(command.get('isStarted')).to.be.true;
- expect(command.start.calledOnce).to.be.true;
- command.set('isPolling', false);
- });
-
- it('command parameter passed, name is "APPLY_CONFIGURATIONS"', function () {
- command.set('name', 'APPLY_CONFIGURATIONS');
- expect(controller.startCommand(command)).to.be.true;
- expect(command.get('isStarted')).to.be.true;
- expect(controller.loadClusterConfigs.calledOnce).to.be.true;
- });
-
- it('command parameter passed, name is "DELETE_ATS"', function () {
- command.set('name', 'DELETE_ATS');
-
- sinon.stub(App.HostComponent, 'find', function() {
- return [Em.Object.create({
- id: 'APP_TIMELINE_SERVER_ats_host',
- componentName: 'APP_TIMELINE_SERVER',
- hostName: 'ats_host'
- })];
- });
- expect(controller.startCommand(command)).to.be.true;
- expect(command.get('isStarted')).to.be.true;
- expect(controller.deleteComponents.calledWith('APP_TIMELINE_SERVER', 'ats_host')).to.be.true;
-
- App.HostComponent.find.restore();
- });
-
- });
-
- describe('#onCompleteCommand()', function () {
-
- beforeEach(function () {
- sinon.spy(controller, "moveToNextCommand");
- sinon.stub(controller, "saveCommands", Em.K);
- });
- afterEach(function () {
- controller.moveToNextCommand.restore();
- controller.saveCommands.restore();
-
- });
-
- it('number of commands doesn\'t match totalSteps', function () {
- controller.set('commands', []);
- controller.set('totalSteps', 1);
- expect(controller.onCompleteCommand()).to.be.false;
- });
- it('No successful commands', function () {
- controller.set('commands', [Em.Object.create({
- isSuccess: false
- })]);
- controller.set('totalSteps', 1);
- expect(controller.onCompleteCommand()).to.be.false;
- });
- it('No successful commands', function () {
- controller.set('commands', [Em.Object.create({
- isSuccess: false
- })]);
- controller.set('totalSteps', 1);
- expect(controller.onCompleteCommand()).to.be.false;
- });
- it('Last command is successful', function () {
- controller.set('commands', [
- Em.Object.create({
- isSuccess: false
- }),
- Em.Object.create({
- isSuccess: true
- })
- ]);
- controller.set('totalSteps', 2);
- expect(controller.onCompleteCommand()).to.be.false;
- });
- it('all commands are successful', function () {
- controller.set('commands', [
- Em.Object.create({
- isSuccess: true,
- name: 'command1'
- }),
- Em.Object.create({
- isSuccess: false,
- name: 'command2'
- })
- ]);
- controller.set('totalSteps', 2);
- expect(controller.onCompleteCommand()).to.be.true;
- expect(controller.moveToNextCommand.calledWith(Em.Object.create({
- isSuccess: false,
- name: 'command2'
- }))).to.be.true;
- });
- });
-
- describe('#moveToNextCommand()', function () {
-
- beforeEach(function () {
- sinon.spy(controller, "startCommand");
- });
- afterEach(function () {
- controller.startCommand.restore();
- });
-
- it('No commands present', function () {
- controller.set('commands', []);
- expect(controller.moveToNextCommand()).to.be.false;
- });
- it('Only started command present', function () {
- controller.set('commands', [
- Em.Object.create({
- isStarted: true
- })
- ]);
- expect(controller.moveToNextCommand()).to.be.false;
- });
- it('Command is not started', function () {
- controller.set('commands', [
- Em.Object.create({
- isStarted: false,
- name: 'command1'
- })
- ]);
- expect(controller.moveToNextCommand()).to.be.true;
- expect(controller.startCommand.calledWith(Em.Object.create({
- isStarted: false,
- name: 'command1'
- }))).to.be.true;
- });
- it('Next command provide as argument', function () {
- var nextCommand = Em.Object.create({
- isStarted: false,
- name: 'command2'
- });
- expect(controller.moveToNextCommand(nextCommand)).to.be.true;
- expect(controller.startCommand.calledWith(Em.Object.create({
- isStarted: false,
- name: 'command2'
- }))).to.be.true;
- });
- });
-
- describe('#setServiceTagNames()', function () {
- var testCases = [
- {
- title: 'configs is empty object',
- content: {
- secureService: {},
- configs: {}
- },
- result: undefined
- },
- {
- title: 'secureService.sites is null',
- content: {
- secureService: {
- sites: null
- },
- configs: {
- site1: {}
- }
- },
- result: undefined
- },
- {
- title: 'secureService.sites doesn\'t contain required config tag',
- content: {
- secureService: {
- sites: []
- },
- configs: {
- site1: {}
- }
- },
- result: undefined
- },
- {
- title: 'secureService.sites contains required config tag',
- content: {
- secureService: {
- sites: ['site1']
- },
- configs: {
- site1: {
- tag: 'tag1'
- }
- }
- },
- result: {
- siteName: 'site1',
- tagName: 'tag1',
- newTagName: null,
- configs: {}
- }
- }
- ];
- testCases.forEach(function (test) {
- it(test.title, function () {
- expect(controller.setServiceTagNames(test.content.secureService, test.content.configs)).to.eql(test.result);
- });
- });
- });
-
- describe('#modifyConfigsForSecure', function () {
- var cfg = {
- properties: {
- 'ui.childopts': 'value1',
- 'supervisor.childopts': 'value2',
- 'common_property': 'value4'
- }
- };
- var siteName = 'storm-site';
- var result = {
- 'ui.childopts': 'value1 -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf',
- 'supervisor.childopts': 'value2 -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf',
- 'common_property': 'value4'
- };
- var propertiesToUpdate = [
- {
- siteName: 'storm-site',
- name: 'ui.childopts',
- append: ' -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf'
- },
- {
- siteName: 'storm-site',
- name: 'supervisor.childopts',
- append: ' -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf'
- }
- ];
- it("should change some storm sonfigs", function () {
- controller.set('propertiesToUpdate', propertiesToUpdate);
- expect(controller.modifyConfigsForSecure(siteName, cfg)).to.eql(result);
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security_test.js b/ambari-web/test/controllers/main/admin/security_test.js
deleted file mode 100644
index 8557c6c..0000000
--- a/ambari-web/test/controllers/main/admin/security_test.js
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * 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');
-require('controllers/main/admin/security');
-
-
-describe('App.MainAdminSecurityController', function () {
-
- var controller = App.MainAdminSecurityController.create({
- getServiceConfigsFromServer: function () {
- } ,
- services: [{serviceName: 'HDFS'}]
- });
-
- describe('#setServiceTagNames()', function () {
- var testCases = [
- {
- title: 'configs is empty object',
- content: {
- secureService: {},
- configs: {}
- },
- result: undefined
- },
- {
- title: 'secureService.sites is null',
- content: {
- secureService: {
- sites: null
- },
- configs: {
- site1: {}
- }
- },
- result: undefined
- },
- {
- title: 'secureService.sites doesn\'t contain required config tag',
- content: {
- secureService: {
- sites: []
- },
- configs: {
- site1: {}
- }
- },
- result: undefined
- },
- {
- title: 'secureService.sites contains required config tag',
- content: {
- secureService: {
- sites: ['site1']
- },
- configs: {
- site1: {
- tag: 'tag1'
- }
- }
- },
- result: {
- siteName: 'site1',
- tagName: 'tag1',
- newTagName: null,
- configs: {}
- }
- }
- ];
- testCases.forEach(function (test) {
- it(test.title, function () {
- expect(controller.setServiceTagNames(test.content.secureService, test.content.configs)).to.eql(test.result);
- });
- });
- });
-
- describe('#getSecurityStatusFromServerSuccessCallback()', function () {
-
- beforeEach(function () {
- sinon.spy(controller, 'showSecurityErrorPopup');
- sinon.spy(controller, 'getServiceConfigsFromServer');
- });
- afterEach(function () {
- controller.showSecurityErrorPopup.restore();
- controller.getServiceConfigsFromServer.restore();
- });
-
- it('desired_configs is empty', function () {
- var data = {Clusters: {
- desired_configs: {}
- }};
- controller.getSecurityStatusFromServerSuccessCallback(data);
- expect(controller.showSecurityErrorPopup.called).to.equal(true);
- });
-
- it('cluster-env is missing', function () {
- var data = {Clusters: {
- desired_configs: {
- 'hdfs-site': {}
- }
- }};
- controller.getSecurityStatusFromServerSuccessCallback(data);
- expect(controller.showSecurityErrorPopup.called).to.equal(true);
- });
-
- it('cluster-env and hdfs-site are correct', function () {
- var data = {Clusters: {
- desired_configs: {
- 'hdfs-site': {
- tag: 1
- },
- 'cluster-env': {
- tag: 2
- },
- 'hadoop-env': {
- tag: 3
- }
- }
- }};
- controller.getSecurityStatusFromServerSuccessCallback(data);
- expect(controller.get('tag.cluster-env')).to.equal(2);
- expect(controller.get('tag.hdfs-site')).to.equal(1);
- expect(controller.getServiceConfigsFromServer.called).to.equal(true);
- });
- });
-
-
- describe('#setNnHaStatus()', function () {
-
- beforeEach(function () {
- sinon.stub(App.db, "setIsNameNodeHa", Em.K);
- });
- afterEach(function () {
- App.db.setIsNameNodeHa.restore();
- });
-
-
- it('hdfsConfigs is null', function () {
- var hdfsConfigs = null;
- controller.setNnHaStatus(hdfsConfigs);
- expect(App.db.setIsNameNodeHa.withArgs('false').called).to.equal(true);
- });
-
- it('"dfs.nameservices" is absent in hdfsConfigs', function () {
- var hdfsConfigs = {};
- controller.setNnHaStatus(hdfsConfigs);
- expect(App.db.setIsNameNodeHa.withArgs('false').called).to.equal(true);
- });
-
- it('namenodesKey is absent in hdfsConfigs', function () {
- var hdfsConfigs = {
- 'dfs.nameservices': 'key'
- };
- controller.setNnHaStatus(hdfsConfigs);
- expect(App.db.setIsNameNodeHa.withArgs('false').called).to.equal(true);
- });
-
- it('namenodesKey is present in hdfsConfigs', function () {
- var hdfsConfigs = {
- 'dfs.nameservices': 'key',
- 'dfs.ha.namenodes.key': 'true'
- };
- controller.setNnHaStatus(hdfsConfigs);
- expect(App.db.setIsNameNodeHa.withArgs('true').called).to.equal(true);
- });
- });
-
- describe('#loadUsers()', function () {
-
- beforeEach(function () {
- sinon.stub(App.db, "setSecureUserInfo", Em.K);
- });
- afterEach(function () {
- App.db.setSecureUserInfo.restore();
- });
-
- it('if defaultUserNameMap is empty then serviceUsers stays the same', function () {
- var configs = {};
- controller.set('serviceUsers', []);
- controller.set('userNameMap', {});
- controller.loadUsers(configs);
- expect(controller.get('serviceUsers')).to.be.empty;
- });
-
- it('if user config value is missing then use default', function () {
- var configs = {};
- controller.set('serviceUsers', []);
- controller.set('userNameMap', {
- test_user: {defaultValue: 'test', siteName: 'test-env', serviceName: 'TEST'
- }});
- controller.loadUsers(configs);
- expect(controller.get('serviceUsers')).to.eql([
- {
- "id": "puppet var",
- "name": "test_user",
- "value": "test"
- }
- ]);
- });
-
- it('user config value has value', function () {
- var configs = {
- 'test_user': 'config-value'
- };
- controller.set('serviceUsers', []);
- controller.set('defaultUserNameMap', {
- test_user: {defaultValue: 'test', siteName: 'test-env', serviceName: 'TEST'
- }});
- controller.loadUsers(configs);
- expect(controller.get('serviceUsers')).to.eql([
- {
- "id": "puppet var",
- "name": "test_user",
- "value": "config-value"
- }
- ]);
- });
- });
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/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 4023a0e..0eb81db 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -397,17 +397,6 @@ describe('App.MainHostDetailsController', function () {
});
});
- describe('#securityEnabled', function () {
- it('', function () {
- sinon.stub(App.router, 'get').withArgs('mainAdminSecurityController.securityEnabled').returns(true);
-
- controller.propertyDidChange('securityEnabled');
- expect(controller.get('securityEnabled')).to.be.true;
- App.router.get.restore();
- });
- });
-
-
describe('#addComponent()', function () {
beforeEach(function () {
sinon.spy(App, "showConfirmationPopup");
@@ -416,15 +405,14 @@ describe('App.MainHostDetailsController', function () {
controller.set('content', {hostComponents: [Em.Object.create({
componentName: "HDFS_CLIENT"
})]});
- controller.reopen({
- securityEnabled: false
- });
+ sinon.stub(componentsUtils, 'checkComponentDependencies', Em.K);
});
afterEach(function () {
App.showConfirmationPopup.restore();
controller.addClientComponent.restore();
controller.primary.restore();
+ componentsUtils.checkComponentDependencies.restore();
});
it('add ZOOKEEPER_SERVER', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index a869663..6207372 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -19,7 +19,6 @@
var App = require('app');
var modelSetup = require('test/init_model_test');
require('utils/ajax/ajax_queue');
-require('controllers/main/admin/security');
require('controllers/main/service/info/configs');
require('controllers/wizard/step8_controller');
var installerStep8Controller, configurationController;
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/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 c02d894..5fcd724 100644
--- a/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
+++ b/ambari-web/test/mixins/wizard/addSeccurityConfigs_test.js
@@ -28,325 +28,9 @@ describe('App.AddSecurityConfigs', function () {
content: {},
enableSubmit: function () {
this._super();
- },
- secureMapping: [],
- secureProperties: []
+ }
});
- describe('#secureServices', function() {
- it('content.services is correct', function() {
- controller.set('content.services', [{}]);
- expect(controller.get('secureServices')).to.eql([{}]);
- controller.reopen({
- secureServices: []
- });
- });
- });
-
- describe('#loadUiSideSecureConfigs()', function() {
-
- beforeEach(function(){
- sinon.stub(controller, 'checkServiceForConfigValue', function() {
- return 'value2';
- });
- sinon.stub(controller, 'setConfigValue', Em.K);
- sinon.stub(controller, 'formatConfigName', Em.K);
- sinon.stub(App.Service, 'find').returns([{serviceName: 'SOME_SERVICE'}]);
- });
- afterEach(function(){
- controller.checkServiceForConfigValue.restore();
- controller.setConfigValue.restore();
- controller.formatConfigName.restore();
- App.Service.find.restore();
- });
-
- it('secureMapping is empty', function() {
- controller.set('secureMapping', []);
-
- expect(controller.loadUiSideSecureConfigs()).to.be.empty;
- });
- it('Config does not have dependedServiceName', function() {
- controller.set('secureMapping', [{
- name: 'config1',
- value: 'value1',
- filename: 'file1',
- serviceName: 'SOME_SERVICE',
- foreignKey: null
- }]);
-
- expect(controller.loadUiSideSecureConfigs()).to.eql([{
- "id": "site property",
- "name": 'config1',
- "value": 'value1',
- "filename": 'file1'
- }]);
- });
- it('Config has dependedServiceName', function() {
- controller.set('secureMapping', [{
- name: 'config1',
- value: 'value1',
- filename: 'file1',
- foreignKey: null,
- serviceName: 'SOME_SERVICE',
- dependedServiceName: 'SOME_SERVICE'
- }]);
-
- expect(controller.loadUiSideSecureConfigs()).to.eql([{
- "id": "site property",
- "name": 'config1',
- "value": 'value2',
- "filename": 'file1'
- }]);
- });
- it('Config has non-existent serviceName', function() {
- controller.set('secureMapping', [{
- name: 'config1',
- value: 'value1',
- filename: 'file1',
- foreignKey: true,
- serviceName: 'NO_SERVICE'
- }]);
-
- expect(controller.loadUiSideSecureConfigs()).to.be.empty;
- });
- it('Config has correct serviceName', function() {
- controller.set('secureMapping', [{
- name: 'config1',
- value: 'value1',
- filename: 'file1',
- foreignKey: true,
- serviceName: 'SOME_SERVICE'
- }]);
-
- expect(controller.loadUiSideSecureConfigs()).to.eql([{
- "id": "site property",
- "name": 'config1',
- "value": 'value1',
- "filename": 'file1'
- }]);
- expect(controller.setConfigValue.calledOnce).to.be.true;
- expect(controller.formatConfigName.calledOnce).to.be.true;
- });
- });
-
- describe('#checkServiceForConfigValue()', function() {
- it('services is empty', function() {
- var services = [];
-
- expect(controller.checkServiceForConfigValue('value1', services)).to.equal('value1');
- });
- it('Service is loaded', function() {
- var services = [{}];
- sinon.stub(App.Service, 'find', function () {
- return Em.Object.create({isLoaded: false});
- });
-
- expect(controller.checkServiceForConfigValue('value1', services)).to.equal('value1');
-
- App.Service.find.restore();
- });
- it('Service is not loaded', function() {
- var services = [{
- replace: 'val'
- }];
- sinon.stub(App.Service, 'find', function () {
- return Em.Object.create({isLoaded: false});
- });
-
- expect(controller.checkServiceForConfigValue('value1', services)).to.equal('ue1');
-
- App.Service.find.restore();
- });
- });
-
- describe('#formatConfigName()', function() {
- it('config.value is null', function() {
- var config = {
- value: null
- };
-
- expect(controller.formatConfigName([], config)).to.be.false;
- });
- it('config.name does not contain foreignKey', function() {
- var config = {
- value: 'value1',
- name: 'config1'
- };
-
- expect(controller.formatConfigName([], config)).to.be.false;
- });
- it('globalProperties is empty, use uiConfig', function() {
- var config = {
- value: 'value1',
- name: '<foreignKey[0]>',
- foreignKey: ['key1']
- };
- controller.set('globalProperties', []);
- var uiConfig = [{
- name: 'key1',
- value: 'globalValue1'
- }];
-
- expect(controller.formatConfigName(uiConfig, config)).to.be.true;
- expect(config._name).to.equal('globalValue1');
- });
-
- });
-
- describe('#setConfigValue()', function() {
- it('config.value is null', function() {
- var config = {
- value: null
- };
-
- expect(controller.setConfigValue(config)).to.be.false;
- });
- it('config.value does not match "templateName"', function() {
- var config = {
- value: ''
- };
-
- expect(controller.setConfigValue(config)).to.be.false;
- });
- it('No such property in global configs', function() {
- var config = {
- value: '<templateName[0]>',
- templateName: ['config1']
- };
- controller.set('globalProperties', []);
- controller.set('configs', []);
-
- expect(controller.setConfigValue(config)).to.be.true;
- expect(config.value).to.be.null;
- });
-
- it('Hive Metastore hostname array is converted to string', function () {
- var config = {
- value: '<templateName[0]>',
- templateName: ['hive_metastore']
- };
- controller.set('globalProperties', []);
- controller.set('configs', [
- {
- name: 'hive_metastore',
- value: ['h0', 'h1', 'h2']
- }
- ]);
-
- expect(controller.setConfigValue(config)).to.be.true;
- expect(config.value).to.equal('h0,h1,h2');
- });
-
- });
-
- describe('#addHostConfig()', function() {
-
- afterEach(function () {
- App.Service.find.restore();
- });
-
- it('No such service loaded', function() {
- sinon.stub(App.Service, 'find', function(){
- return Em.Object.create({isLoaded: false});
- });
-
- expect(controller.addHostConfig('service1', 'comp1', 'config1')).to.be.false;
- });
- it('No such service in secureServices', function() {
- sinon.stub(App.Service, 'find', function(){
- return Em.Object.create({isLoaded: true});
- });
- controller.set('secureServices', []);
-
- expect(controller.addHostConfig('service1', 'comp1', 'config1')).to.be.false;
- });
- it('Service does not have such host-component', function() {
- sinon.stub(App.Service, 'find', function(){
- return Em.Object.create({
- isLoaded: true,
- hostComponents: []
- });
- });
- controller.set('secureServices', [{
- serviceName: 'service1'
- }]);
-
- expect(controller.addHostConfig('service1', 'comp1', 'config1')).to.be.false;
- });
- });
-
- describe('#getPrincipalNames()', function() {
-
- beforeEach(function () {
- controller.set('globalProperties', []);
- controller.set('secureProperties', []);
- });
-
- it('globalProperties and secureProperties are empty', function() {
- expect(controller.getPrincipalNames()).to.be.empty;
- });
- it('global property name does not match "principal_name"', function() {
- controller.set('globalProperties', [{
- name: 'config1'
- }]);
- expect(controller.getPrincipalNames()).to.be.empty;
- });
- it('secure property name does not match "principal_name"', function() {
- controller.set('secureProperties', [{
- name: 'config1'
- }]);
- expect(controller.getPrincipalNames()).to.be.empty;
- });
- it('property with such name already exists', function() {
- controller.set('globalProperties', [{
- name: 'principal_name'
- }]);
- controller.set('secureProperties', [{
- name: 'principal_name'
- }]);
- expect(controller.getPrincipalNames().mapProperty('name')).to.eql(['principal_name']);
- });
- });
-
- describe('#loadUsersFromServer()', function() {
- it('testMode = true', function() {
- controller.set('testModeUsers', [{
- name: 'user1',
- value: 'value1'
- }]);
- controller.set('serviceUsers', []);
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
- });
-
- controller.loadUsersFromServer();
- expect(controller.get('serviceUsers')).to.eql([{
- name: 'user1',
- value: 'value1',
- id: 'puppet var'
- }]);
- App.get.restore();
- });
- it('testMode = false', function() {
- sinon.stub(App.router, 'set', Em.K);
- sinon.stub(App.db, 'getSecureUserInfo', function(){
- return [];
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
-
- controller.loadUsersFromServer();
- expect(App.db.getSecureUserInfo.calledOnce).to.be.true;
- expect(App.router.set.calledWith('mainAdminSecurityController.serviceUsers', [])).to.be.true;
-
- App.router.set.restore();
- App.get.restore();
- App.db.getSecureUserInfo.restore();
- });
- });
describe('#createServicesStackDescriptorConfigs', function() {
var result = controller.createServicesStackDescriptorConfigs(stackDescriptorData);
@@ -398,14 +82,14 @@ describe('App.AddSecurityConfigs', function () {
property: 'realm',
e: [
{ key: 'isEditable', value: false },
- { key: 'serviceName', value: 'Cluster' },
+ { key: 'serviceName', value: 'Cluster' }
]
},
{
property: 'keytab_dir',
e: [
{ key: 'isEditable', value: true },
- { key: 'serviceName', value: 'Cluster' },
+ { key: 'serviceName', value: 'Cluster' }
]
}
];
@@ -459,7 +143,7 @@ describe('App.AddSecurityConfigs', function () {
{
property: 'dfs.namenode.kerberos.principal',
e: [
- { key: 'filename', value: 'hdfs-site' },
+ { key: 'filename', value: 'hdfs-site' }
]
},
{
@@ -571,7 +255,7 @@ describe('App.AddSecurityConfigs', function () {
generateProperty('component_prop1_inherited_principal', 'component_prop1:principal'),
generateProperty('component_prop1_inherited_keytab', 'component_prop1:keytab'),
generateProperty('component_prop2_inherited_keytab', 'component_prop2:keytab'),
- generateProperty('component_prop2_inherited_principal', 'component_prop2:principal'),
+ generateProperty('component_prop2_inherited_principal', 'component_prop2:principal')
]);
var tests = [
{ name: 'spnego_inherited_keytab', e: 'spnego_keytab' },
[4/4] ambari git commit: AMBARI-11995 Remove add security wizard from
Ambari. (ababiichuk)
Posted by ab...@apache.org.
AMBARI-11995 Remove add security wizard from Ambari. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/c61933d8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/c61933d8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/c61933d8
Branch: refs/heads/trunk
Commit: c61933d870b94f85aa41f91fa6728019ed74211f
Parents: 59a74cf
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Thu Jun 18 16:43:46 2015 +0300
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Thu Jun 18 16:44:06 2015 +0300
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 8 -
ambari-web/app/controllers.js | 8 -
.../app/controllers/main/admin/kerberos.js | 2 +-
.../main/admin/kerberos/disable_controller.js | 1 -
.../app/controllers/main/admin/security.js | 387 ------
.../security/add/addSecurity_controller.js | 163 ---
.../main/admin/security/add/step1.js | 32 -
.../main/admin/security/add/step2.js | 449 -------
.../main/admin/security/add/step3.js | 448 -------
.../main/admin/security/add/step4.js | 203 ---
.../controllers/main/admin/security/disable.js | 212 ---
.../security/security_progress_controller.js | 465 -------
ambari-web/app/controllers/main/host/details.js | 9 -
.../app/controllers/wizard/step7_controller.js | 8 -
ambari-web/app/data/HDP2/secure_configs.js | 162 ---
ambari-web/app/data/HDP2/secure_properties.js | 1268 ------------------
ambari-web/app/data/controller_route.js | 8 -
ambari-web/app/messages.js | 28 +-
.../app/mixins/wizard/addSecurityConfigs.js | 324 -----
ambari-web/app/routes/add_security.js | 242 ----
ambari-web/app/routes/main.js | 39 +-
.../kerberos/notify_security_off_popup.hbs | 21 +
.../app/templates/main/admin/security.hbs | 43 -
.../templates/main/admin/security/add/menu.hbs | 42 -
.../templates/main/admin/security/add/step1.hbs | 38 -
.../templates/main/admin/security/add/step2.hbs | 34 -
.../templates/main/admin/security/add/step3.hbs | 31 -
.../templates/main/admin/security/add/step4.hbs | 32 -
.../templates/main/admin/security/disable.hbs | 26 -
.../security/notify_security_off_popup.hbs | 21 -
ambari-web/app/utils/host_progress_popup.js | 11 -
ambari-web/app/views.js | 8 -
.../configs/service_configs_by_category_view.js | 2 +-
ambari-web/app/views/main/admin/security.js | 53 -
.../app/views/main/admin/security/add/menu.js | 27 -
.../app/views/main/admin/security/add/step1.js | 33 -
.../app/views/main/admin/security/add/step2.js | 50 -
.../app/views/main/admin/security/add/step3.js | 28 -
.../app/views/main/admin/security/add/step4.js | 50 -
.../app/views/main/admin/security/disable.js | 44 -
.../security/add/addSecurity_controller_test.js | 256 ----
.../main/admin/security/add/step1_test.js | 72 -
.../main/admin/security/add/step2_test.js | 718 ----------
.../main/admin/security/add/step3_test.js | 560 --------
.../main/admin/security/add/step4_test.js | 484 -------
.../main/admin/security/disable_test.js | 386 ------
.../security_progress_controller_test.js | 443 ------
.../controllers/main/admin/security_test.js | 235 ----
.../test/controllers/main/host/details_test.js | 16 +-
.../test/controllers/wizard/step8_test.js | 1 -
.../mixins/wizard/addSeccurityConfigs_test.js | 326 +----
51 files changed, 32 insertions(+), 8525 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index f832a48..a0be22e 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -63,14 +63,6 @@ var files = ['test/init_model_test',
'test/controllers/main/admin/highAvailability/nameNode/step3_controller_test',
'test/controllers/main/admin/highAvailability/nameNode/step4_controller_test',
'test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test',
- 'test/controllers/main/admin/security_test',
- 'test/controllers/main/admin/security/disable_test',
- 'test/controllers/main/admin/security/security_progress_controller_test',
- 'test/controllers/main/admin/security/add/addSecurity_controller_test',
- 'test/controllers/main/admin/security/add/step1_test',
- 'test/controllers/main/admin/security/add/step2_test',
- 'test/controllers/main/admin/security/add/step3_test',
- 'test/controllers/main/admin/security/add/step4_test',
'test/controllers/main/dashboard/config_history_controller_test',
'test/controllers/main/charts/heatmap_test',
'test/controllers/main/charts/heatmap_metrics/heatmap_metric_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers.js b/ambari-web/app/controllers.js
index 652142d..7748790 100644
--- a/ambari-web/app/controllers.js
+++ b/ambari-web/app/controllers.js
@@ -72,14 +72,6 @@ require('controllers/main/admin/kerberos/step5_controller');
require('controllers/main/admin/kerberos/step6_controller');
require('controllers/main/admin/kerberos/step7_controller');
require('controllers/main/admin/kerberos/step8_controller');
-require('controllers/main/admin/security');
-require('controllers/main/admin/security/security_progress_controller');
-require('controllers/main/admin/security/disable');
-require('controllers/main/admin/security/add/addSecurity_controller');
-require('controllers/main/admin/security/add/step1');
-require('controllers/main/admin/security/add/step2');
-require('controllers/main/admin/security/add/step3');
-require('controllers/main/admin/security/add/step4');
require('controllers/main/admin/authentication');
require('controllers/main/alert_definitions_controller');
require('controllers/main/alerts/alert_definitions_actions_controller');
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/kerberos.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos.js b/ambari-web/app/controllers/main/admin/kerberos.js
index 2bc7cfd..7e7fff8 100644
--- a/ambari-web/app/controllers/main/admin/kerberos.js
+++ b/ambari-web/app/controllers/main/admin/kerberos.js
@@ -63,7 +63,7 @@ App.MainAdminKerberosController = App.KerberosWizardStep4Controller.extend({
this.hide();
},
bodyClass: Ember.View.extend({
- templateName: require('templates/main/admin/security/notify_security_off_popup')
+ templateName: require('templates/main/admin/kerberos/notify_security_off_popup')
})
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/kerberos/disable_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/kerberos/disable_controller.js b/ambari-web/app/controllers/main/admin/kerberos/disable_controller.js
index 84e7007..cec4503 100644
--- a/ambari-web/app/controllers/main/admin/kerberos/disable_controller.js
+++ b/ambari-web/app/controllers/main/admin/kerberos/disable_controller.js
@@ -18,7 +18,6 @@
var App = require('app');
require('controllers/main/admin/kerberos/progress_controller');
-require('controllers/main/admin/security/security_progress_controller');
App.KerberosDisableController = App.KerberosProgressPageController.extend(App.WizardEnableDone, {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security.js b/ambari-web/app/controllers/main/admin/security.js
deleted file mode 100644
index 54c257f..0000000
--- a/ambari-web/app/controllers/main/admin/security.js
+++ /dev/null
@@ -1,387 +0,0 @@
-/**
- * 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');
-App.MainAdminSecurityController = Em.Controller.extend({
- name: 'mainAdminSecurityController',
- isSubmitDisabled: false,
- securityEnabled: false,
- dataIsLoaded: false,
- isRecommendedLoaded: true,
- serviceUsers: [],
- tag: {},
- getAddSecurityWizardStatus: function () {
- return App.db.getSecurityWizardStatus();
- },
- setAddSecurityWizardStatus: function (status) {
- App.db.setSecurityWizardStatus(status);
- },
-
- setDisableSecurityStatus: function (status) {
- App.db.setDisableSecurityStatus(status);
- },
- getDisableSecurityStatus: function (status) {
- return App.db.getDisableSecurityStatus();
- },
- content: Em.Object.create({
- isATSInstalled: function() {
- // Because the ATS component can be installed/removed at will, the check has to happen every time that security is added.
- var yarnService = App.Service.find().findProperty('serviceName','YARN');
- return !!yarnService && yarnService.get('hostComponents').someProperty('componentName', 'APP_TIMELINE_SERVER');
- }.property('App.router.clusterController.isLoaded')
- }),
- notifySecurityOff: false,
- notifySecurityAdd: false,
-
- stepConfigs: [],
- desiredConfigs: [],
- securityUsers: [],
- serviceConfigTags: [],
- selectedService: null,
- isNotEditable: true,
- /** need to define <code>filter, filterColumns</code> properties
- * for preventing errors in <code>App.ServiceConfigsByCategoryView</code>
- */
- filter: '',
- filterColumns: function () {
- return [];
- }.property(''),
- services: function () {
- var secureServices = $.extend(true, [], require('data/HDP2/secure_configs'));
- var services = [];
-
- // Typically, ATS will support Kerberos in HDP 2.2 and higher
- if (this.get('content.isATSInstalled') && App.get('doesATSSupportKerberos')) {
- var yarnConfigCategories = secureServices.findProperty('serviceName', 'YARN').configCategories;
- yarnConfigCategories.push(App.ServiceConfigCategory.create({ name: 'AppTimelineServer', displayName : 'Application Timeline Service'}));
- }
-
- var installedServices = App.Service.find().mapProperty('serviceName');
- //General (only non service tab) tab is always displayed
- services.push(secureServices.findProperty('serviceName', 'GENERAL'));
- installedServices.forEach(function (_service) {
- var secureService = secureServices.findProperty('serviceName', _service);
- if (secureService) {
- services.push(secureService);
- }
- }, this);
- return services;
- }.property('App.router.clusterController.isLoaded'),
-
- /**
- * default values of configs, which contains user names
- */
- userNameMap: {
- 'hdfs_user': {defaultValue: 'hdfs', siteName: 'hadoop-env', serviceName: 'HDFS'},
- 'yarn_user': {defaultValue: 'yarn', siteName: 'yarn-env', serviceName: 'YARN'},
- 'mapred_user': {defaultValue: 'mapred', siteName: 'mapred-env', serviceName: 'MAPREDUCE2'},
- 'hbase_user': {defaultValue: 'hbase', siteName: 'hbase-env', serviceName: 'HBASE'},
- 'hive_user': {defaultValue: 'hive', siteName: 'hive-env', serviceName: 'HIVE'},
- 'proxyuser_group': {defaultValue: 'users', siteName: 'hadoop-env', serviceName: 'HDFS'},
- 'smokeuser': {defaultValue: 'ambari-qa', siteName: 'cluster-env', serviceName: 'CLUSTER'},
- 'zk_user': {defaultValue: 'zookeeper', siteName: 'zookeeper-env', serviceName: 'ZOOKEEPER'},
- 'oozie_user': {defaultValue: 'oozie', siteName: 'oozie-env', serviceName: 'OOZIE'},
- 'user_group': {defaultValue: 'hadoop', siteName: 'hadoop-env', serviceName: 'HDFS'},
- 'storm_user': {defaultValue: 'storm', siteName: 'storm-env', serviceName: 'STORM'},
- 'falcon_user': {defaultValue: 'falcon', siteName: 'falcon-env', serviceName: 'FALCON'},
- 'knox_user': {defaultValue: 'knox', siteName: 'knox-env', serviceName: 'KNOX'}
- },
-
- loadStep: function () {
- var step2Controller = App.router.get('mainAdminSecurityAddStep2Controller');
- var services = this.get('services');
- var self = this;
- step2Controller.set('content', Em.Object.create({services: []}));
- step2Controller.set('content.services', services);
- this.get('stepConfigs').clear();
- this.get('securityUsers').clear();
- this.get('serviceConfigTags').clear();
- this.loadSecurityUsers();
- //loadSecurityUsers - desired configs fetched from server
- step2Controller.addUserPrincipals(services, this.get('securityUsers'));
- step2Controller.addMasterHostToConfigs();
- step2Controller.addSlaveHostToConfigs();
- this.renderServiceConfigs(services);
- step2Controller.changeCategoryOnHa(services, this.get('stepConfigs'));
-
- services.forEach(function (_secureService) {
- this.setServiceTagNames(_secureService, this.get('desiredConfigs'));
- }, this);
- App.router.get('configurationController').getConfigsByTags(this.get('serviceConfigTags')).done(function (serverConfigs) {
- self.setConfigValuesFromServer(self.get('stepConfigs'), serverConfigs);
- self.set('installedServices', App.Service.find().mapProperty('serviceName'));
- });
- },
-
- /**
- * get actual values of configurations from server
- * @param stepConfigs
- * @param serverConfigs
- */
- setConfigValuesFromServer: function (stepConfigs, serverConfigs) {
- var allConfigs = {};
- serverConfigs.mapProperty('properties').forEach(function (_properties) {
- allConfigs = $.extend(allConfigs, _properties);
- }, this);
- // for all services`
- stepConfigs.forEach(function (_content) {
- //for all components
- _content.get('configs').forEach(function (_config) {
-
- var componentVal = allConfigs[_config.get('name')];
- //if we have config for specified component
- if (componentVal) {
- //set it
- _config.set('value', componentVal);
- }
- }, this);
- }, this);
- },
-
- /**
- * set tag names according to installed services and desired configs
- * @param secureService
- * @param configs
- * @return {Object}
- */
- setServiceTagNames: function (secureService, configs) {
- for (var index in configs) {
- if (secureService.sites && secureService.sites.contains(index)) {
- var serviceConfigObj = {
- siteName: index,
- tagName: configs[index].tag,
- newTagName: null,
- configs: {}
- };
- this.get('serviceConfigTags').pushObject(serviceConfigObj);
- }
- }
- return serviceConfigObj;
- },
-
- loadSecurityUsers: function () {
- var securityUsers = this.get('serviceUsers');
- if (!securityUsers || securityUsers.length < 1) { // Page could be refreshed in middle
- if (App.get('testMode')) {
- securityUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'hdfs'});
- securityUsers.pushObject({id: 'puppet var', name: 'mapred_user', value: 'mapred'});
- securityUsers.pushObject({id: 'puppet var', name: 'hbase_user', value: 'hbase'});
- securityUsers.pushObject({id: 'puppet var', name: 'hive_user', value: 'hive'});
- securityUsers.pushObject({id: 'puppet var', name: 'smokeuser', value: 'ambari-qa'});
- } else {
- this.setSecurityStatus();
- securityUsers = this.get('serviceUsers');
- }
- }
- this.set('securityUsers', securityUsers);
- },
- /**
- * Load child components to service config object
- * @param _componentConfig
- * @param componentConfig
- */
- loadComponentConfigs: function (_componentConfig, componentConfig) {
- _componentConfig.configs.forEach(function (_serviceConfigProperty) {
- var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
- componentConfig.configs.pushObject(serviceConfigProperty);
- serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isReconfigurable'));
- serviceConfigProperty.validate();
- }, this);
- },
-
- /**
- * Render configs for active services
- * @param serviceConfigs
- */
- renderServiceConfigs: function (serviceConfigs) {
- serviceConfigs.forEach(function (_serviceConfig) {
-
- var serviceConfig = App.ServiceConfig.create({
- filename: _serviceConfig.filename,
- serviceName: _serviceConfig.serviceName,
- displayName: _serviceConfig.displayName,
- configCategories: _serviceConfig.configCategories,
- showConfig: true,
- configs: []
- });
-
- this.loadComponentConfigs(_serviceConfig, serviceConfig);
-
- console.log('pushing ' + serviceConfig.serviceName, serviceConfig);
-
- this.get('stepConfigs').pushObject(serviceConfig);
- }, this);
- this.set('selectedService', this.get('stepConfigs').filterProperty('showConfig', true).objectAt(0));
- },
-
- notifySecurityOffPopup: function () {
- var self = this;
- if (!this.get('isSubmitDisabled')) {
- App.ModalPopup.show({
- header: Em.I18n.t('popup.confirmation.commonHeader'),
- primary: Em.I18n.t('ok'),
- onPrimary: function () {
- App.db.setSecurityDeployCommands(undefined);
- self.setDisableSecurityStatus("RUNNING");
- App.router.transitionTo('disableSecurity');
- this.hide();
- },
- bodyClass: Ember.View.extend({
- templateName: require('templates/main/admin/security/notify_security_off_popup')
- })
- })
- }
- },
-
- getUpdatedSecurityStatus: function () {
- this.setSecurityStatus();
- return this.get('securityEnabled');
- },
-
- setSecurityStatus: function () {
- if (App.get('testMode')) {
- this.set('securityEnabled', !App.get('testEnableSecurity'));
- this.set('dataIsLoaded', true);
- } else {
- //get Security Status From Server
- App.ajax.send({
- name: 'admin.security_status',
- sender: this,
- success: 'getSecurityStatusFromServerSuccessCallback',
- error: 'errorCallback'
- });
- }
- },
-
- errorCallback: function (jqXHR) {
- this.set('dataIsLoaded', true);
- // Show the error popup if the API call received a response from the server.
- // jqXHR.status will be empty when browser cancels the request. Refer to AMBARI-5921 for more info
- if (!!jqXHR.status) {
- this.showSecurityErrorPopup();
- }
- },
-
- getSecurityStatusFromServerSuccessCallback: function (data) {
- var configs = data.Clusters.desired_configs;
- var serviceNames = this.get('services').mapProperty('serviceName');
- var configTags = [];
- this.set('desiredConfigs', configs);
- for (var key in this.userNameMap) {
- if (serviceNames.contains(this.userNameMap[key]['serviceName']) || this.userNameMap[key]['serviceName'] === 'CLUSTER')
- configTags.push(this.userNameMap[key]['siteName']);
- }
- configTags = configTags.uniq();
-
- var errorFlag = false;
- configTags.forEach(function (_tag) {
- if (!configs[_tag]) {
- errorFlag = true;
- }
- }, this);
-
- if (errorFlag) {
- this.showSecurityErrorPopup();
- } else {
- var tags = configTags.map(function (_tag) {
- this.set('tag.' + _tag, configs[_tag].tag);
- return {
- siteName: _tag,
- tagName: configs[_tag].tag
- }
- }, this);
-
- if ('hdfs-site' in configs) {
- this.set('tag.hdfs-site', configs['hdfs-site'].tag);
- tags.pushObject({
- siteName: "hdfs-site",
- tagName: this.get('tag.hdfs-site')
- });
- }
- this.getServiceConfigsFromServer(tags);
- }
- },
-
- getServiceConfigsFromServer: function (tags) {
- var self = this;
-
- App.router.get('configurationController').getConfigsByTags(tags).done(function (data) {
- var configs = data.findProperty('tag', self.get('tag.cluster-env')).properties;
- if (configs && (configs['security_enabled'] === 'true' || configs['security_enabled'] === true)) {
- self.set('securityEnabled', true);
- }
- else {
- self.set('securityEnabled', false);
- if (!!self.get('tag.hdfs-site')) {
- var hdfsConfigs = data.findProperty('tag', self.get('tag.hdfs-site')).properties;
- self.setNnHaStatus(hdfsConfigs);
- }
- }
- var userConfigs = {};
- data.forEach(function(_config){
- $.extend(userConfigs, _config.properties);
- });
- self.loadUsers(userConfigs);
- self.set('dataIsLoaded', true);
- });
- },
-
- setNnHaStatus: function (hdfsConfigs) {
- var nnHaStatus = hdfsConfigs && hdfsConfigs['dfs.nameservices'];
- var namenodesKey;
- if (nnHaStatus) {
- namenodesKey = 'dfs.ha.namenodes.' + hdfsConfigs['dfs.nameservices'];
- }
- if (nnHaStatus && hdfsConfigs[namenodesKey]) {
- App.db.setIsNameNodeHa('true');
- } else {
- App.db.setIsNameNodeHa('false');
- }
- },
-
- /**
- * load users names,
- * substitute missing values with default
- * @param configs {Object}
- */
- loadUsers: function (configs) {
- var defaultUserNameMap = this.get('userNameMap');
- this.set('serviceUsers',[]);
-
- for (var configName in defaultUserNameMap) {
- this.get('serviceUsers').push({
- id: 'puppet var',
- name: configName,
- value: configs[configName] || defaultUserNameMap[configName]['defaultValue']
- });
- }
- App.db.setSecureUserInfo(this.get('serviceUsers'));
- },
-
- showSecurityErrorPopup: function () {
- App.ModalPopup.show({
- header: Em.I18n.t('common.error'),
- secondary: false,
- bodyClass: Ember.View.extend({
- template: Ember.Handlebars.compile('<p>{{t admin.security.status.error}}</p>')
- })
- });
- }
-});
-
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js b/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
deleted file mode 100644
index cf5fb77..0000000
--- a/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * 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');
-App.AddSecurityController = App.WizardController.extend({
-
- name: 'addSecurityController',
- securityEnabled: false,
-
- totalSteps: 4,
-
- content: Em.Object.create({
- services: [],
- isNnHa: 'false',
- serviceConfigProperties: null,
- controllerName: 'addSecurityController',
- isATSInstalled: function() {
- // Because the ATS component can be installed/removed at will, the check has to happen every time that security is added.
- var yarnService = App.Service.find().findProperty('serviceName','YARN');
- return !!yarnService && yarnService.get('hostComponents').someProperty('componentName', 'APP_TIMELINE_SERVER');
- }.property('App.router.clusterController.isLoaded')
- }),
-
- /**
- * installed services on cluster
- */
- installedServices: function () {
- return App.Service.find().mapProperty('serviceName');
- }.property(),
-
- /**
- * services with security configurations
- */
- secureServices: function () {
- var configCategories = require('data/HDP2/secure_configs');
- if (this.get('content.isATSInstalled') && App.get('doesATSSupportKerberos')) {
- var yarnConfigCategories = configCategories.findProperty('serviceName', 'YARN').configCategories;
- yarnConfigCategories.push(App.ServiceConfigCategory.create({ name: 'AppTimelineServer', displayName : 'Application Timeline Service'}));
- }
- return configCategories;
- }.property('App.router.clusterController.isLoaded'),
-
- /**
- * Loads all prior steps on refresh
- */
- loadAllPriorSteps: function () {
- var step = this.get('currentStep');
- switch (step) {
- case '4':
- case '3':
- case '2':
- this.loadServiceConfigs();
- case '1':
- this.loadServices();
- this.loadNnHaStatus();
- }
- },
- /**
- * Load installed services, which match secure services, to content
- */
- loadServices: function () {
- var secureServices = this.get('secureServices');
- var installedServices = this.get('installedServices');
-
- this.get('content.services').clear();
- //General (only non service tab) tab is always displayed
- this.get('content.services').push(secureServices.findProperty('serviceName', 'GENERAL'));
- installedServices.forEach(function (_service) {
- var secureService = secureServices.findProperty('serviceName', _service);
- if (secureService) {
- this.get('content.services').push(secureService);
- }
- }, this);
- },
- /**
- * identify whether NameNode in high availability mode
- */
- loadNnHaStatus: function () {
- this.set('content.isNnHa', App.db.getIsNameNodeHa());
- },
-
- /**
- * save service config properties to localStorage
- * @param stepController
- */
- saveServiceConfigProperties: function (stepController) {
- var serviceConfigProperties = [];
- stepController.get('stepConfigs').forEach(function (_content) {
- _content.get('configs').forEach(function (_configProperties) {
- _configProperties.set('value', App.config.trimProperty(_configProperties, true));
- var configProperty = {
- id: _configProperties.get('id'),
- name: _configProperties.get('name'),
- value: _configProperties.get('value'),
- defaultValue: _configProperties.get('defaultValue'),
- serviceName: _configProperties.get('serviceName'),
- domain: _configProperties.get('domain'),
- filename: _configProperties.get('filename'),
- unit: _configProperties.get('unit'),
- components: _configProperties.get('components'),
- component: _configProperties.get('component'),
- overrides: this.getConfigOverrides(_configProperties)
- };
- serviceConfigProperties.push(configProperty);
- }, this);
- }, this);
- App.db.setSecureConfigProperties(serviceConfigProperties);
- this.set('content.serviceConfigProperties', serviceConfigProperties);
- },
-
- /**
- * get overrides of config
- * @param _configProperties
- * @return {Array}
- */
- getConfigOverrides: function (_configProperties) {
- var overrides = _configProperties.get('overrides');
- var overridesArray = [];
- if (Array.isArray(overrides)) {
- overrides.forEach(function (override) {
- var overrideEntry = {
- value: override.get('value'),
- hosts: []
- };
- override.get('selectedHostOptions').forEach(function (host) {
- overrideEntry.hosts.push(host);
- });
- overridesArray.push(overrideEntry);
- });
- }
- return (overridesArray.length > 0) ? overridesArray : null;
- },
-
- /**
- * Load service config properties from localStorage
- */
- loadServiceConfigs: function () {
- this.set('content.serviceConfigProperties', App.db.getSecureConfigProperties());
- },
-
- /**
- * Clear all local storage data for Add security wizard namespace
- */
- finish: function () {
- this.resetDbNamespace();
- }
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/security/add/step1.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step1.js b/ambari-web/app/controllers/main/admin/security/add/step1.js
deleted file mode 100644
index 51494c7..0000000
--- a/ambari-web/app/controllers/main/admin/security/add/step1.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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');
-App.MainAdminSecurityAddStep1Controller = Em.Controller.extend({
-
- name: 'mainAdminSecurityAddStep1Controller',
- /**
- * identify whether ATS(Application Timeline Server) is installed and does not support Kerberization.
- * @return {Boolean}
- */
- shouldRemoveATS: function() {
- var isATSInstalled = this.get('content.isATSInstalled');
- var doesATSSupportKerberos = App.get("doesATSSupportKerberos");
- return isATSInstalled && !doesATSSupportKerberos;
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/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
deleted file mode 100644
index e9e37ff..0000000
--- a/ambari-web/app/controllers/main/admin/security/add/step2.js
+++ /dev/null
@@ -1,449 +0,0 @@
-/**
- * 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');
-var stringUtils = require('utils/string_utils');
-
-App.MainAdminSecurityAddStep2Controller = Em.Controller.extend({
-
- name: 'mainAdminSecurityAddStep2Controller',
- isRecommendedLoaded: true,
- stepConfigs: [],
- installedServices: [],
- selectedService: null,
- securityUsers: [],
- filter: '',
- filterColumns: [],
-
- /**
- * map which depict connection between config and slave component
- * in order to set component hosts to config value
- */
- slaveComponentMap: [
- {
- serviceName: 'HDFS',
- configName: 'datanode_hosts',
- component: 'DATANODE'
- },
- {
- serviceName: 'YARN',
- configName: 'nodemanager_host',
- component: 'NODEMANAGER'
- },
- {
- serviceName: 'HBASE',
- configName: 'regionserver_hosts',
- component: 'HBASE_REGIONSERVER'
- },
- {
- serviceName: 'STORM',
- configName: 'supervisor_hosts',
- component: 'SUPERVISOR'
- }
- ],
- /**
- * map which depict connection between config and master component
- * in order to set component hosts to config value
- */
- masterComponentMap: [
- {
- serviceName: 'OOZIE',
- configName: 'oozie_servername',
- components: ['OOZIE_SERVER']
- },
- {
- serviceName: 'HIVE',
- configName: 'hive_metastore',
- components: ['HIVE_METASTORE', 'HIVE_SERVER']
- },
- {
- serviceName: 'HIVE',
- configName: 'webhcatserver_host',
- components: ['WEBHCAT_SERVER']
- },
- {
- serviceName: 'HDFS',
- configName: 'namenode_host',
- components: ['NAMENODE']
- },
- {
- serviceName: 'HDFS',
- configName: 'snamenode_host',
- components: ['SECONDARY_NAMENODE']
- },
- {
- serviceName: 'HDFS',
- configName: 'journalnode_hosts',
- components: ['JOURNALNODE']
- },
- {
- serviceName: 'MAPREDUCE2',
- configName: 'jobhistoryserver_host',
- components: ['HISTORYSERVER']
- },
- {
- serviceName: 'YARN',
- configName: 'resourcemanager_host',
- components: ['RESOURCEMANAGER']
- },
- {
- serviceName: 'YARN',
- configName: 'apptimelineserver_host',
- components: ['APP_TIMELINE_SERVER']
- },
- {
- serviceName: 'HBASE',
- configName: 'hbasemaster_host',
- components: ['HBASE_MASTER']
- },
- {
- serviceName: 'ZOOKEEPER',
- configName: 'zookeeperserver_hosts',
- components: ['ZOOKEEPER_SERVER']
- },
- {
- serviceName: 'FALCON',
- configName: 'falcon_server_host',
- components: ['FALCON_SERVER']
- },
- {
- serviceName: 'STORM',
- configName: 'storm_host',
- components: ['STORM_UI_SERVER', 'NIMBUS', 'SUPERVISOR']
- },
- {
- serviceName: 'STORM',
- configName: 'nimbus_host',
- components: ['NIMBUS']
- },
- {
- serviceName: 'KNOX',
- configName: 'knox_gateway_hosts',
- components: ['KNOX_GATEWAY']
- }
- ],
-
- hostToPrincipalMap: [
- {
- serviceName: 'OOZIE',
- configName: 'oozie_servername',
- principalName: 'oozie_principal_name',
- primaryName: 'oozie/'
- },
- {
- serviceName: 'OOZIE',
- configName: 'oozie_servername',
- principalName: 'oozie_http_principal_name',
- primaryName: 'HTTP/'
- },
- {
- serviceName: 'FALCON',
- configName: 'falcon_server_host',
- principalName: 'falcon_principal_name',
- primaryName: 'falcon/'
- },
- {
- serviceName: 'FALCON',
- configName: 'falcon_server_host',
- principalName: 'falcon_http_principal_name',
- primaryName: 'HTTP/'
- },
- {
- serviceName: 'HIVE',
- configName: 'webhcatserver_host',
- principalName: 'webHCat_http_principal_name',
- primaryName: 'HTTP/'
- }
- ],
-
- isSubmitDisabled: function () {
- return !this.get('stepConfigs').filterProperty('showConfig').everyProperty('errorCount', 0);
- }.property('stepConfigs.@each.errorCount'),
-
- /**
- * clear info of step
- */
- clearStep: function () {
- this.get('stepConfigs').clear();
- this.get('securityUsers').clear();
- },
-
- /**
- * Function is called whenever the step is loaded
- */
- loadStep: function () {
- console.log("TRACE: Loading addSecurity step2: Configure Services");
- var versionNumber = App.get('currentStackVersionNumber');
- if( stringUtils.compareVersions(versionNumber, "2.2") >= 0){
- // Add Nimbus config options
- var masterComponentMap = this.get('masterComponentMap');
- masterComponentMap.filterProperty('configName', 'storm_host').components = ["SUPERVISOR", "STORM_UI_SERVER", "DRPC_SERVER", "STORM_REST_API"];
- masterComponentMap.pushObject({
- serviceName: 'STORM',
- configName: 'nimbus_host',
- components: ['NIMBUS']
- });
- this.get('hostToPrincipalMap').pushObject({
- serviceName: 'STORM',
- configName: 'nimbus_host',
- principalName: 'storm_principal_name',
- primaryName: 'storm'
- });
- }
- this.clearStep();
- this.loadUsers();
- this.addUserPrincipals(this.get('content.services'), this.get('securityUsers'));
- this.addMasterHostToConfigs();
- this.addHostPrincipals();
- this.addSlaveHostToConfigs();
- this.renderServiceConfigs(this.get('content.services'));
- this.changeCategoryOnHa(this.get('content.services'), this.get('stepConfigs'));
- this.setStoredConfigsValue(this.get('content.serviceConfigProperties'));
- this.set('installedServices', App.Service.find().mapProperty('serviceName'));
- },
-
- /**
- * set stored values to service configs
- * @param storedConfigProperties
- * @return {Boolean}
- */
- setStoredConfigsValue: function (storedConfigProperties) {
- if (!storedConfigProperties) return false;
-
- // for all services`
- this.get('stepConfigs').forEach(function (_content) {
- _content.get('configs').forEach(function (_config) {
- var configProperty = storedConfigProperties.findProperty('name', _config.get('name'));
-
- if (configProperty) {
- _config.set('value', configProperty.value);
- }
- }, this);
- }, this);
- return true;
- },
-
- /**
- * Render configs for active services
- * @param serviceConfigs
- */
- renderServiceConfigs: function (serviceConfigs) {
- serviceConfigs.forEach(function (_serviceConfig) {
- var serviceConfig = App.ServiceConfig.create({
- filename: _serviceConfig.filename,
- serviceName: _serviceConfig.serviceName,
- displayName: _serviceConfig.displayName,
- configCategories: _serviceConfig.configCategories,
- showConfig: true,
- configs: this.wrapConfigProperties(_serviceConfig)
- });
-
- this.get('stepConfigs').pushObject(serviceConfig);
- }, this);
- this.set('selectedService', this.get('stepConfigs').filterProperty('showConfig').objectAt(0));
- },
-
- /**
- * wrap configs into App.ServiceConfigProperty objects
- * @param _componentConfig
- */
- wrapConfigProperties: function (_componentConfig) {
- var configs = [];
- _componentConfig.configs.forEach(function (_serviceConfigProperty) {
- var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
- serviceConfigProperty.set('isEditable', serviceConfigProperty.get('isReconfigurable'));
- serviceConfigProperty.validate();
- configs.pushObject(serviceConfigProperty);
- }, this);
- return configs;
- },
-
- /**
- * fill config with hosts of component
- * @param serviceName
- * @param configName
- * @param componentNames
- * @return {Boolean}
- */
- setHostsToConfig: function (serviceName, configName, componentNames) {
- var service = this.get('content.services').findProperty('serviceName', serviceName);
- if (service) {
- var hosts = service.configs.findProperty('name', configName);
- if (hosts) {
- hosts.defaultValue = App.Service.find(service.serviceName)
- .get('hostComponents')
- .filter(function (component) {
- return componentNames.contains(component.get('componentName'));
- })
- .mapProperty('hostName')
- .uniq();
- return true;
- }
- return false;
- }
- return false;
- },
-
- /**
- * set principal default value based on config host and default primary name
- * @param serviceName
- * @param hostConfigName
- * @param principalConfigName
- * @param defaultPrimaryName
- * @return {Boolean}
- */
- setHostToPrincipal: function (serviceName, hostConfigName, principalConfigName, defaultPrimaryName) {
- var service = this.get('content.services').findProperty('serviceName', serviceName);
- if (service) {
- var host = service.configs.findProperty('name', hostConfigName);
- var principal = service.configs.findProperty('name', principalConfigName);
- var versionNumber = App.get('currentStackVersionNumber');
- 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;
- }
- if (host && principal) {
- var host_defaultValue = Array.isArray(host.defaultValue) ? host.defaultValue[0] : host.defaultValue;
- principal.defaultValue = defaultPrimaryName + host_defaultValue;
- return true;
- }
- return false;
- }
- return false;
- },
-
- /**
- * load services users
- */
- loadUsers: function () {
- var securityUsers = App.router.get('mainAdminSecurityController').get('serviceUsers');
- if (Em.isNone(securityUsers) || securityUsers.length === 0) {
- if (App.get('testMode')) {
- securityUsers = securityUsers || [];
- securityUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'hdfs'});
- securityUsers.pushObject({id: 'puppet var', name: 'mapred_user', value: 'mapred'});
- securityUsers.pushObject({id: 'puppet var', name: 'hbase_user', value: 'hbase'});
- securityUsers.pushObject({id: 'puppet var', name: 'hive_user', value: 'hive'});
- securityUsers.pushObject({id: 'puppet var', name: 'smokeuser', value: 'ambari-qa'});
- } else {
- securityUsers = App.db.getSecureUserInfo();
- }
- }
- this.set('securityUsers', securityUsers);
- },
-
- /**
- * set default values to user principals and control their visibility
- * @param serviceConfigs
- * @param securityUsers
- */
- addUserPrincipals: function (serviceConfigs, securityUsers) {
- var generalService = serviceConfigs.findProperty('serviceName', 'GENERAL').configs;
- this.setUserPrincipalValue(securityUsers.findProperty('name', 'smokeuser'), generalService.findProperty('name', 'smokeuser_principal_name'));
- var servicesWithUserPrincipals = ['HDFS', 'HBASE'];
-
- servicesWithUserPrincipals.forEach(function (serviceName) {
- var isServiceInstalled = serviceConfigs.someProperty('serviceName', serviceName);
- var userPrincipal = generalService.findProperty('name', serviceName.toLowerCase() + '_principal_name');
- var userKeytab = generalService.findProperty('name', serviceName.toLowerCase() + '_user_keytab');
- var userName = securityUsers.findProperty('name', serviceName.toLowerCase() + '_user');
- if (isServiceInstalled && this.setUserPrincipalValue(userName, userPrincipal)) {
- userPrincipal.isVisible = true;
- userKeytab.isVisible = true;
- }
- }, this);
- },
- /**
- * set default value of user principal
- * @param user
- * @param userPrincipal
- */
- setUserPrincipalValue: function (user, userPrincipal) {
- if (user && userPrincipal) {
- userPrincipal.defaultValue = user.value;
- return true;
- }
- return false;
- },
-
- /**
- * put hosts of slave component into defaultValue of configs
- */
- addSlaveHostToConfigs: function () {
- this.get('slaveComponentMap').forEach(function (service) {
- this.setHostsToConfig(service.serviceName, service.configName, [service.component]);
- }, this);
- },
-
- /**
- * put hosts of master component into defaultValue of configs
- */
- addMasterHostToConfigs: function () {
- this.get('masterComponentMap').forEach(function (item) {
- this.setHostsToConfig(item.serviceName, item.configName, item.components);
- }, this);
- },
-
- /**
- * put hosts to principal default values
- */
- addHostPrincipals: function () {
- this.get('hostToPrincipalMap').forEach(function (item) {
- this.setHostToPrincipal(item.serviceName, item.configName, item.principalName, item.primaryName);
- }, this);
- },
-
- /**
- * modify config categories depending on whether HA is enabled or not
- * @param serviceConfigs
- * @param stepConfigs
- */
- changeCategoryOnHa: function (serviceConfigs, stepConfigs) {
- var hdfsService = serviceConfigs.findProperty('serviceName', 'HDFS');
- if (hdfsService) {
- var properties = stepConfigs.findProperty('serviceName', 'HDFS').get('configs');
- var configCategories = hdfsService.configCategories;
- if ((App.get('testMode') && App.get('testNameNodeHA')) || (this.get('content.isNnHa') === 'true')) {
- this.removeConfigCategory(properties, configCategories, 'SNameNode');
- } else {
- this.removeConfigCategory(properties, configCategories, 'JournalNode');
- }
- return true;
- }
- return false;
- },
- /**
- * remove config category that belong to component and hide category configs
- * @param properties
- * @param configCategories
- * @param component
- */
- removeConfigCategory: function (properties, configCategories, component) {
- properties.filterProperty('category', component).forEach(function (_snConfig) {
- _snConfig.set('isVisible', false);
- }, this);
- var category = configCategories.findProperty('name', component);
- if (category) {
- configCategories.removeObject(category);
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/security/add/step3.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step3.js b/ambari-web/app/controllers/main/admin/security/add/step3.js
deleted file mode 100644
index 0e66cc5..0000000
--- a/ambari-web/app/controllers/main/admin/security/add/step3.js
+++ /dev/null
@@ -1,448 +0,0 @@
-/**
- * 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');
-var stringUtils = require('utils/string_utils');
-
-App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
- name: 'mainAdminSecurityAddStep3Controller',
- hostComponents: [],
- hosts: [],
- isLoaded: false,
-
- componentToUserMap: function() {
- var map = {
- 'NAMENODE': 'hdfs_user',
- 'SECONDARY_NAMENODE': 'hdfs_user',
- 'DATANODE': 'hdfs_user',
- 'JOURNALNODE': 'hdfs_user',
- 'TASKTRACKER': 'mapred_user',
- 'JOBTRACKER': 'mapred_user',
- 'HISTORYSERVER': 'mapred_user',
- 'RESOURCEMANAGER': 'yarn_user',
- 'NODEMANAGER': 'yarn_user',
- 'ZOOKEEPER_SERVER': 'zk_user',
- 'HIVE_SERVER': 'hive_user',
- 'HIVE_METASTORE': 'hive_user',
- 'OOZIE_SERVER': 'oozie_user',
- 'HBASE_MASTER': 'hbase_user',
- 'HBASE_REGIONSERVER': 'hbase_user',
- 'SUPERVISOR': 'storm_user',
- 'NIMBUS': 'storm_user',
- 'STORM_UI_SERVER': 'storm_user',
- 'FALCON_SERVER': 'falcon_user',
- 'KNOX_GATEWAY': 'knox_user',
- 'APP_TIMELINE_SERVER': 'yarn_user'
- };
- if (App.get('isHadoop22Stack')) {
- map['DRPC_SERVER'] = 'storm_user'
- }
- return map;
- }.property('App.isHadoop22Stack'),
- // The componentName, principal, and keytab have to coincide with the values in secure_properties.js
- componentToConfigMap: [
- {
- componentName: 'NAMENODE',
- principal: 'hadoop_http_principal_name',
- keytab: 'hadoop_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.hdfs.user.httpUser')
- },
- {
- componentName: 'SECONDARY_NAMENODE',
- principal: 'hadoop_http_principal_name',
- keytab: 'hadoop_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.hdfs.user.httpUser')
- },
- {
- componentName: 'JOURNALNODE',
- principal: 'hadoop_http_principal_name',
- keytab: 'hadoop_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.hdfs.user.httpUser')
- },
- {
- componentName: 'WEBHCAT_SERVER',
- principal: 'webHCat_http_principal_name',
- keytab: 'webhcat_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.webhcat.user.httpUser')
- },
- {
- componentName: 'HIVE_SERVER',
- principal: 'hive_metastore_http_principal_name',
- keytab: 'hive_metastore_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.hive.user.httpUser')
- },
- {
- componentName: 'OOZIE_SERVER',
- principal: 'oozie_http_principal_name',
- keytab: 'oozie_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.oozie.user.httpUser')
- },
- {
- componentName: 'FALCON_SERVER',
- principal: 'falcon_http_principal_name',
- keytab: 'falcon_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.falcon.user.httpUser')
- },
- {
- componentName: 'HISTORYSERVER',
- principal: 'jobhistory_http_principal_name',
- keytab: 'jobhistory_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.historyServer.user.httpUser')
- },
- {
- componentName: 'RESOURCEMANAGER',
- principal: 'resourcemanager_http_principal_name',
- keytab: 'resourcemanager_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.rm.user.httpUser')
- },
- {
- componentName: 'NODEMANAGER',
- principal: 'nodemanager_http_principal_name',
- keytab: 'nodemanager_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.nm.user.httpUser')
- },
- {
- componentName: 'APP_TIMELINE_SERVER',
- principal: 'apptimelineserver_http_principal_name',
- keytab: 'apptimelineserver_http_keytab',
- displayName: Em.I18n.t('admin.addSecurity.user.yarn.atsHTTPUser')
- },
- {
- componentName: 'STORM_UI_SERVER',
- principal: 'storm_ui_principal_name',
- keytab: 'storm_ui_keytab',
- displayName: Em.I18n.t('admin.addSecurity.storm.user.httpUser'),
- isHadoop22Stack: true
- }
- ],
-
- mandatoryConfigs: [
- {
- userConfig: 'smokeuser',
- keytab: 'smokeuser_keytab',
- displayName: Em.I18n.t('admin.addSecurity.user.smokeUser')
- },
- {
- userConfig: 'hdfs_user',
- keytab: 'hdfs_user_keytab',
- displayName: Em.I18n.t('admin.addSecurity.user.hdfsUser'),
- checkService: 'HDFS'
- },
- {
- userConfig: 'hbase_user',
- keytab: 'hbase_user_keytab',
- displayName: Em.I18n.t('admin.addSecurity.user.hbaseUser'),
- checkService: 'HBASE'
- }
- ],
-
- /**
- * download CSV file
- */
- doDownloadCsv: function () {
- if ($.browser.msie && $.browser.version < 10) {
- this.openInfoInNewTab();
- } else {
- try {
- var blob = new Blob([stringUtils.arrayToCSV(this.get('hostComponents'))], {type: "text/csv;charset=utf-8;"});
- saveAs(blob, "host-principal-keytab-list.csv");
- } catch (e) {
- this.openInfoInNewTab();
- }
- }
- },
-
- /**
- * open content of CSV file in new window
- */
- openInfoInNewTab: function () {
- var newWindow = window.open('');
- var newDocument = newWindow.document;
- newDocument.write(stringUtils.arrayToCSV(this.get('hostComponents')));
- newWindow.focus();
- },
-
- /**
- * load hosts from server
- */
- loadHosts: function () {
- App.ajax.send({
- name: 'hosts.security.wizard',
- sender: this,
- data: {},
- error: 'loadHostsErrorCallback',
- success: 'loadHostsSuccessCallback'
- })
- },
-
- loadHostsSuccessCallback: function (data, opt, params) {
- var hosts = [];
-
- data.items.forEach(function (item) {
- var hostComponents = [];
-
- item.host_components.forEach(function (hostComponent) {
- hostComponents.push(Em.Object.create({
- componentName: hostComponent.HostRoles.component_name,
- service: Em.Object.create({
- serviceName: hostComponent.HostRoles.service_name
- }),
- displayName: App.format.role(hostComponent.HostRoles.component_name)
- }));
- });
- hosts.push(Em.Object.create({
- hostName: item.Hosts.host_name,
- hostComponents: hostComponents
- }));
- });
- this.set('isLoaded', true);
- this.set('hosts', hosts);
- this.loadStep();
- },
- loadHostsErrorCallback: function () {
- this.set('isLoaded', true);
- this.set('hosts', []);
- this.loadStep();
- },
-
- /**
- * load step info
- */
- loadStep: function () {
- var hosts = this.get('hosts');
- var result = [];
- var securityUsers = this.getSecurityUsers();
- var hadoopGroupId = securityUsers.findProperty('name', 'user_group').value;
- var addedPrincipalsHost = {}; //Keys = host_principal, Value = 'true'
-
- hosts.forEach(function (host) {
- this.setMandatoryConfigs(result, securityUsers, host.get('hostName'), hadoopGroupId);
- this.setComponentsConfig(result, host, hadoopGroupId);
- this.setHostComponentsSecureValue(result, host, addedPrincipalsHost, securityUsers, hadoopGroupId);
- }, this);
- this.set('hostComponents', result);
- },
-
- /**
- * Returns host name for Nimbus component
- */
- getNimbusHostName: function () {
- var host = this.get('hosts').find(function (host) {
- return !!host.get('hostComponents').findProperty('componentName', 'NIMBUS');
- });
- if (host) {
- return host.get('hostName');
- }
- },
-
- /**
- * build map of connections between component and user
- * @param securityUsers
- */
- buildComponentToOwnerMap: function (securityUsers) {
- var componentToUserMap = this.get('componentToUserMap');
- var componentToOwnerMap = {};
- for (var component in componentToUserMap) {
- var user = componentToUserMap[component];
- var securityUser = securityUsers.findProperty('name', user);
- componentToOwnerMap[component] = securityUser.value;
- }
- return componentToOwnerMap;
- },
-
- /**
- * set security settings(principal and keytab) to component depending on whether host has such component
- * @param result
- * @param host
- * @param hadoopGroupId
- */
- setComponentsConfig: function (result, host, hadoopGroupId) {
- var hostComponents = host.get('hostComponents');
-
- var isATSInstalled = this.get('content.isATSInstalled');
- var doesATSSupportKerberos = App.get("doesATSSupportKerberos");
-
- this.get('componentToConfigMap').forEach(function (component) {
- //add specific components that supported only in Hadoop2 stack
- if (component.isHadoop22Stack && !App.get('isHadoop22Stack')) return;
-
- if (hostComponents.someProperty('componentName', component.componentName)) {
-
- if (component.componentName === "APP_TIMELINE_SERVER" && (!isATSInstalled || !doesATSSupportKerberos)) {
- return;
- }
-
- var configs = this.get('content.serviceConfigProperties');
- var serviceName = App.StackServiceComponent.find(component.componentName).get('serviceName');
- var serviceConfigs = configs.filterProperty('serviceName', serviceName);
- var servicePrincipal = serviceConfigs.findProperty('name', component.principal);
- var serviceKeytabPath = serviceConfigs.findProperty('name', component.keytab).value;
- result.push({
- host: host.get('hostName'),
- component: component.displayName,
- principal: this.getPrincipal(servicePrincipal, host.get('hostName')),
- keytabfile: stringUtils.getFileFromPath(serviceKeytabPath),
- keytab: stringUtils.getPath(serviceKeytabPath),
- owner: 'root',
- group: hadoopGroupId,
- acl: '440'
- });
- }
- }, this);
- },
-
- /**
- * set security settings(principal and keytab) to component
- * if checkService is passed then verify that service to his existence in order to set configs to such service
- * @param result
- * @param securityUsers
- * @param hostName
- * @param hadoopGroupId
- */
- setMandatoryConfigs: function (result, securityUsers, hostName, hadoopGroupId) {
- var generalConfigs = this.get('content.serviceConfigProperties').filterProperty('serviceName', 'GENERAL');
- var realm = generalConfigs.findProperty('name', 'kerberos_domain').value;
- var installedServices = App.Service.find().mapProperty('serviceName');
-
- this.get('mandatoryConfigs').forEach(function (config) {
- if (config.checkService && !installedServices.contains(config.checkService)) return;
-
- var userId = securityUsers.findProperty('name', config.userConfig).value;
- var userKeytabPath = generalConfigs.findProperty('name', config.keytab).value;
- result.push({
- host: hostName,
- component: config.displayName,
- principal: userId + '@' + realm,
- keytabFile: stringUtils.getFileFromPath(userKeytabPath),
- keytab: stringUtils.getPath(userKeytabPath),
- owner: userId,
- group: hadoopGroupId,
- acl: '440'
- });
- }, this);
- },
-
- /**
- * set secure properties(keytab and principal) for components, which should be displayed
- * @param result
- * @param host
- * @param addedPrincipalsHost
- * @param securityUsers
- * @param hadoopGroupId
- */
- setHostComponentsSecureValue: function (result, host, addedPrincipalsHost, securityUsers, hadoopGroupId) {
- var componentsToDisplay = ['NAMENODE', 'SECONDARY_NAMENODE', 'DATANODE', 'JOBTRACKER', 'ZOOKEEPER_SERVER', 'HIVE_SERVER', 'HIVE_METASTORE',
- 'TASKTRACKER', 'OOZIE_SERVER', 'HBASE_MASTER', 'HBASE_REGIONSERVER', 'HISTORYSERVER', 'RESOURCEMANAGER', 'NODEMANAGER',
- 'JOURNALNODE', 'SUPERVISOR', 'NIMBUS', 'STORM_UI_SERVER','FALCON_SERVER', 'KNOX_GATEWAY', 'APP_TIMELINE_SERVER'];
- if (App.get('isHadoop22Stack')) {
- componentsToDisplay.push('DRPC_SERVER');
- }
- var configs = this.get('content.serviceConfigProperties');
- var componentToOwnerMap = this.buildComponentToOwnerMap(securityUsers);
- var hostName = host.get('hostName');
-
- var isATSInstalled = this.get('content.isATSInstalled');
- var doesATSSupportKerberos = App.get("doesATSSupportKerberos");
-
- host.get('hostComponents').forEach(function (hostComponent) {
- if (componentsToDisplay.contains(hostComponent.get('componentName'))) {
- var serviceConfigs = configs.filterProperty('serviceName', hostComponent.get('service.serviceName'));
- var targetHost = hostName;
- if (App.get('isHadoop22Stack') && hostComponent.get('componentName') === 'DRPC_SERVER') {
- targetHost = this.getNimbusHostName()
- }
- var secureProperties = this.getSecureProperties(serviceConfigs, hostComponent.get('componentName'), targetHost);
- var displayName = this.changeDisplayName(hostComponent.get('displayName'));
- var key = hostName + "--" + secureProperties.principal;
-
- if (hostComponent.get('componentName') === "APP_TIMELINE_SERVER" && (!isATSInstalled || !doesATSSupportKerberos)) {
- return;
- }
-
- if (Em.isNone(addedPrincipalsHost[key])) {
- var owner = componentToOwnerMap[hostComponent.get('componentName')] || '';
-
- result.push({
- host: hostName,
- component: displayName,
- principal: secureProperties.principal,
- keytabFile: stringUtils.getFileFromPath(secureProperties.keytab),
- keytab: stringUtils.getPath(secureProperties.keytab),
- owner: owner,
- group: hadoopGroupId,
- acl: '400'
- });
- addedPrincipalsHost[key] = true;
- }
- }
- }, this);
- },
-
- /**
- * get properties (keytab and principle) of secure config that match component
- * @param serviceConfigs
- * @param componentName
- * @param hostName
- * @return {Object}
- */
- getSecureProperties: function (serviceConfigs, componentName, hostName) {
- var secureProperties = {};
- serviceConfigs.forEach(function (config) {
- if ((config.component && config.component === componentName) ||
- (config.components && config.components.contains(componentName))) {
- if (config.name.endsWith('_principal_name')) {
- secureProperties.principal = this.getPrincipal(config, hostName);
- } else if (config.name.endsWith('_keytab') || config.name.endsWith('_keytab_path')) {
- secureProperties.keytab = config.value;
- }
- }
- }, this);
- return secureProperties;
- },
-
- /**
- * get formatted principal value
- * @param config
- * @param hostName
- * @return {String}
- */
- getPrincipal: function (config, hostName) {
- return config.value.replace('_HOST', hostName.toLowerCase()) + config.unit;
- },
-
- /**
- * get users from security configs
- * @return {Array}
- */
- getSecurityUsers: function () {
- return App.db.getSecureUserInfo();
- },
-
- /**
- * format display names of specific components
- * @param name
- * @return {*}
- */
- changeDisplayName: function (name) {
- if (name === 'HiveServer2' || name === 'Hive Metastore') {
- return 'Hive Metastore and HiveServer2';
- } else {
- return name;
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/security/add/step4.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/add/step4.js b/ambari-web/app/controllers/main/admin/security/add/step4.js
deleted file mode 100644
index 406892d..0000000
--- a/ambari-web/app/controllers/main/admin/security/add/step4.js
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep4Controller = App.MainAdminSecurityProgressController.extend(App.AddSecurityConfigs, {
-
- name: 'mainAdminSecurityAddStep4Controller',
-
- isBackBtnDisabled: function () {
- return !this.get('commands').someProperty('isError');
- }.property('commands.@each.isCompleted'),
-
- isSecurityApplied: function () {
- return this.get('commands').someProperty('name', 'START_SERVICES') && this.get('commands').findProperty('name', 'START_SERVICES').get('isSuccess');
- }.property('commands.@each.isCompleted'),
-
- /**
- * control disabled property of completion button
- */
- enableSubmit: function () {
- var addSecurityController = App.router.get('addSecurityController');
- if (this.get('commands').someProperty('isError') || this.get('commands').everyProperty('isSuccess')) {
- this.set('isSubmitDisabled', false);
- if (this.get('commands').someProperty('isError')) {
- addSecurityController.setStepsEnable();
- }
- } else {
- this.set('isSubmitDisabled', true);
- addSecurityController.setLowerStepsDisable(4);
- }
- }.observes('commands.@each.isCompleted'),
-
- /**
- * clear step info
- */
- clearStep: function () {
- this.set('commands', []);
- this.set('isSubmitDisabled', true);
- this.get('serviceConfigTags').clear();
- },
-
- loadCommands: function () {
- this._super();
-
- // Determine if ATS Component needs to be removed
- var isATSInstalled = this.get('content.isATSInstalled');
- var doesATSSupportKerberos = App.get("doesATSSupportKerberos");
- if (isATSInstalled && !doesATSSupportKerberos) {
- this.get('commands').splice(2, 0, App.Poll.create({name: 'DELETE_ATS', label: Em.I18n.translations['admin.addSecurity.apply.delete.ats'], isPolling: false}));
- }
- },
-
- /**
- * load step info
- */
- loadStep: function () {
- this.clearStep();
- this.prepareSecureConfigs();
-
- if (!this.resumeSavedCommands()) {
- this.loadCommands();
- this.addInfoToCommands();
- this.syncStopServicesOperation();
- this.addObserverToCommands();
- this.moveToNextCommand();
- }
- },
-
- /**
- * synchronize "STOP_SERVICES" operation from BO with command of step
- * @return {Boolean}
- */
- syncStopServicesOperation: function () {
- var runningOperations = App.router.get('backgroundOperationsController.services').filterProperty('isRunning');
- var stopAllOperation = runningOperations.findProperty('name', 'Stop All Services');
- var stopCommand = this.get('commands').findProperty('name', 'STOP_SERVICES');
- if (stopCommand && stopAllOperation) {
- stopCommand.set('requestId', stopAllOperation.get('id'));
- return true;
- }
- return false;
- },
-
- /**
- * resume previously saved commands
- * @return {Boolean}
- */
- resumeSavedCommands: function () {
- var commands = App.db.getSecurityDeployCommands();
- if (Em.isNone(commands) || commands.length === 0) return false;
-
- commands.forEach(function (_command, index) {
- commands[index] = App.Poll.create(_command);
- }, this);
- if (commands.someProperty('isError')) {
- this.get('commands').pushObjects(commands);
- this.addObserverToCommands();
- return true;
- } else if (commands.filterProperty('isStarted').someProperty('isCompleted', false)) {
- var runningCommand = commands.filterProperty('isStarted').findProperty('isCompleted', false);
- runningCommand.set('isStarted', false);
- this.get('commands').pushObjects(commands);
- } else {
- this.get('commands').pushObjects(commands);
- }
- this.addObserverToCommands();
- this.moveToNextCommand();
- return true;
- },
-
- manageSecureConfigs: function () {
- var serviceConfigTags = this.get('serviceConfigTags');
- var secureConfigs = this.get('secureConfigs');
- var siteProperties = this.get('configs');
- if (serviceConfigTags) {
- secureConfigs.forEach(function (config) {
- this.setPrincipalValue(config.serviceName, config.name);
- }, this);
- serviceConfigTags.forEach(function (_serviceConfigTags) {
- _serviceConfigTags.newTagName = 'version' + (new Date).getTime();
- siteProperties.filterProperty('filename', _serviceConfigTags.siteName + '.xml').forEach(function (_config) {
- if (!/_hosts?$/.test(_config.name)) {
- _serviceConfigTags.configs[_config.name] = _config.value;
- }
- }, this);
- }, this);
- return true;
- } else {
- var command = this.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- command.set('isSuccess', false);
- command.set('isError', true);
- this.onJsError();
- return false;
- }
- },
-
- /**
- * send DELETE command to server to delete component
- * @param componentName
- * @param hostName
- */
- deleteComponents: function(componentName, hostName) {
- App.ajax.send({
- name: 'common.delete.host_component',
- sender: this,
- data: {
- componentName: componentName,
- hostName: hostName
- },
- success: 'onDeleteComplete',
- error: 'onDeleteError'
- });
- },
-
- /**
- * callback on successful deletion of component
- */
- onDeleteComplete: function () {
- var deleteAtsCommand = this.get('commands').findProperty('name', 'DELETE_ATS');
- console.warn('APP_TIMELINE_SERVER doesn\'t support security mode in this HDP stack. It has been removed from YARN service ');
- deleteAtsCommand.set('isError', false);
- deleteAtsCommand.set('isSuccess', true);
- },
-
- /**
- * callback on failed deletion of component
- */
- onDeleteError: function () {
- var deleteAtsCommand = this.get('commands').findProperty('name', 'DELETE_ATS');
- console.warn('Error: Can\'t delete APP_TIMELINE_SERVER');
- deleteAtsCommand.set('isError', true);
- deleteAtsCommand.set('isSuccess', false);
- },
-
- /**
- * show popup when js error occurred
- */
- onJsError: function () {
- App.ModalPopup.show({
- header: Em.I18n.t('common.error'),
- secondary: false,
- bodyClass: Ember.View.extend({
- template: Ember.Handlebars.compile('<p>{{t admin.security.apply.configuration.error}}</p>')
- })
- });
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/security/disable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/disable.js b/ambari-web/app/controllers/main/admin/security/disable.js
deleted file mode 100644
index 728ba67..0000000
--- a/ambari-web/app/controllers/main/admin/security/disable.js
+++ /dev/null
@@ -1,212 +0,0 @@
-/**
- * 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');
-require('controllers/main/admin/security/security_progress_controller');
-
-App.MainAdminSecurityDisableController = App.MainAdminSecurityProgressController.extend({
- name: 'mainAdminSecurityDisableController',
- secureServices: [],
- /**
- * values of site configs when security disabled.
- * Properties not defined in data/secure_mapping or data/HDP2/secure_mapping and needs to be changed on disabling
- * security should be defined in secureConfigValuesMap Object
- */
- secureConfigValuesMap: {
- 'nimbus.childopts': function(value) {
- return value.replace (/-Djava.security.auth.login.config\s*=\s*\S*/g, "");
- },
- 'ui.childopts': function(value) {
- return value.replace (/-Djava.security.auth.login.config\s*=\s*\S*/g, "");
- },
- 'supervisor.childopts': function(value) {
- return value.replace (/-Djava.security.auth.login.config\s*=\s*\S*/g, "");
- }
- },
-
- isSubmitDisabled: function () {
- return !(this.get('commands').someProperty('isError') || this.get('commands').everyProperty('isSuccess'));
- }.property('commands.@each.isCompleted'),
-
- /**
- * clear step info
- */
- clearStep: function () {
- this.get('commands').clear();
- this.get('secureServices').clear();
- this.get('serviceConfigTags').clear();
- },
-
- /**
- * load info required by current step
- */
- loadStep: function () {
- this.clearStep();
- var commands = App.db.getSecurityDeployCommands();
- if (commands && commands.length > 0) {
- commands.forEach(function (_command, index) {
- commands[index] = App.Poll.create(_command);
- }, this);
- if (commands.someProperty('isError', true)) {
- this.get('commands').pushObjects(commands);
- this.loadSecureServices();
- this.addObserverToCommands();
- return;
- } else if (commands.filterProperty('isStarted', true).someProperty('isCompleted', false)) {
- var runningCommand = commands.filterProperty('isStarted', true).findProperty('isCompleted', false);
- runningCommand.set('isStarted', false);
- this.get('commands').pushObjects(commands);
- } else {
- this.get('commands').pushObjects(commands);
- }
- } else {
- this.loadCommands();
- this.addInfoToCommands();
- this.syncStopServicesCommand();
- }
- this.loadSecureServices();
- this.addObserverToCommands();
- this.moveToNextCommand();
- },
-
- /**
- * resume info about commands from local storage
- * @return {Boolean}
- */
- resumeCommands: function () {
- var commands = App.db.getSecurityDeployCommands();
- if (!commands || commands.length === 0) return false;
-
- commands.forEach(function (_command) {
- this.get('commands').pushObject(App.Poll.create(_command));
- }, this);
- var runningCommand = this.get('commands').filterProperty('isStarted').findProperty('isCompleted', false);
- if (runningCommand) {
- runningCommand.set('isStarted', false);
- }
- return true;
- },
-
- /**
- * synchronize existing background operation "Stop All Services" with command in Security wizard
- */
- syncStopServicesCommand: function () {
- var runningOperations = App.router.get('backgroundOperationsController.services').filterProperty('isRunning');
- var stopAllOperation = runningOperations.findProperty('name', 'Stop All Services');
- var stopCommand = this.get('commands').findProperty('name', 'STOP_SERVICES');
- if (stopCommand && stopAllOperation) {
- stopCommand.set('requestId', stopAllOperation.get('id'));
- }
- },
-
- /**
- * load secure configs of installed services
- */
- loadSecureServices: function () {
- var secureServices = require('data/HDP2/secure_configs');
- var installedServices = App.Service.find().mapProperty('serviceName');
- this.get('secureServices').pushObject(secureServices.findProperty('serviceName', 'GENERAL'));
- //General (only non service tab) tab is always displayed
- installedServices.forEach(function (_service) {
- var secureService = secureServices.findProperty('serviceName', _service);
- if (secureService) {
- this.get('secureServices').pushObject(secureService);
- }
- }, this);
- },
-
- /**
- * manage configurations from serviceConfigTags
- * @return {Boolean}
- */
- manageSecureConfigs: function () {
- var serviceConfigTags = this.get('serviceConfigTags');
- var secureProperties = this.get('secureProperties');
- var secureMapping = this.get('secureMapping');
- if (!serviceConfigTags || !secureProperties || !secureMapping) {
- var command = this.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- command.set('isSuccess', false);
- command.set('isError', true);
- return false;
- } else {
- serviceConfigTags.forEach(function (_serviceConfigTags) {
- _serviceConfigTags.newTagName = 'version' + (new Date).getTime();
- if (_serviceConfigTags.siteName.contains('-env')) {
- this.deleteDisabledConfigs(secureProperties, _serviceConfigTags);
- if (_serviceConfigTags.siteName === 'cluster-env') {
- _serviceConfigTags.configs.security_enabled = 'false';
- }
- } else {
- this.modifySiteConfigs(secureMapping, _serviceConfigTags);
- }
- }, this);
- return true;
- }
- },
- /**
- * delete configs, which aren't required when security disabled
- * @param secureProperties
- * @param _serviceConfigTags
- * @return {Boolean}
- */
- deleteDisabledConfigs: function (secureProperties, _serviceConfigTags) {
- if (!secureProperties || !_serviceConfigTags) return false;
- secureProperties.forEach(function (_config) {
- if (_config.name in _serviceConfigTags.configs) {
- delete _serviceConfigTags.configs[_config.name];
- }
- }, this);
- return true;
- },
- /**
- * delete unnecessary site configs and
- * change config values
- * @param secureMapping
- * @param _serviceConfigTags
- * @return {Boolean}
- */
- modifySiteConfigs: function (secureMapping, _serviceConfigTags) {
- var secureConfigValuesMap = this.get('secureConfigValuesMap');
- if (!secureMapping || !_serviceConfigTags) return false;
-
- // iterate over secureConfigValuesMap to update service-site configProperties not present in secureMapping metadata
- for (var key in secureConfigValuesMap) {
- if (key in _serviceConfigTags.configs) {
- var value = secureConfigValuesMap[key];
- if (typeof value == 'function') {
- _serviceConfigTags.configs[key] = value(_serviceConfigTags.configs[key]);
- } else if (value) {
- _serviceConfigTags.configs[key] = value;
- }
- }
- }
-
- secureMapping.filterProperty('filename', _serviceConfigTags.siteName + '.xml').forEach(function (_config) {
- var configName = _config.name;
- var nonSecureConfigValue = _config.nonSecureValue;
- if (configName in _serviceConfigTags.configs) {
- if (nonSecureConfigValue) {
- _serviceConfigTags.configs[configName] = nonSecureConfigValue;
- } else {
- delete _serviceConfigTags.configs[configName]
- }
- }
- }, this);
- return true;
- }
-});
[3/4] ambari git commit: AMBARI-11995 Remove add security wizard from
Ambari. (ababiichuk)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/controllers/main/admin/security/security_progress_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/security/security_progress_controller.js b/ambari-web/app/controllers/main/admin/security/security_progress_controller.js
deleted file mode 100644
index bf93ee2..0000000
--- a/ambari-web/app/controllers/main/admin/security/security_progress_controller.js
+++ /dev/null
@@ -1,465 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityProgressController = Em.Controller.extend({
- name: 'mainAdminSecurityProgressController',
-
- commands: [],
- configs: [],
- serviceConfigTags: [],
- totalSteps: 3,
- isSubmitDisabled: true,
- hasHostPopup: true,
- services: [],
- serviceTimestamp: null,
- operationsInfo: [
- {
- name: 'STOP_SERVICES',
- realUrl: '/services',
- testUrl: '/data/wizard/deploy/2_hosts/poll_1.json',
- data: '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.stopAllServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}'
- },
- {
- name: 'START_SERVICES',
- realUrl: '/services?params/run_smoke_test=true',
- testUrl: '/data/wizard/deploy/2_hosts/poll_1.json',
- data: '{"RequestInfo": {"context": "' + Em.I18n.t('requestInfo.startAllServices') + '"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}'
- }
- ],
-
- secureMapping: require('data/HDP2/secure_mapping'),
-
- secureProperties: require('data/HDP2/secure_properties').configProperties,
-
- /**
- * prepare and restart failed command
- */
- retry: function () {
- var failedCommand = this.get('commands').findProperty('isError');
- if (failedCommand) {
- failedCommand.set('requestId', null);
- failedCommand.set('isStarted', false);
- failedCommand.set('isError', false);
- this.startCommand(failedCommand);
- }
- },
-
- /**
- * start updating current task in parallel
- * @param requestId
- * @param taskId
- * @return {Boolean}
- */
- startUpdatingTask: function (requestId, taskId) {
- if (!requestId || !taskId) return false;
- var command = this.get('commands').findProperty('requestId', requestId);
- command.updateTaskLog(taskId);
- return true;
- },
-
- /**
- * stop updating current task
- * @param requestId
- * @return {Boolean}
- */
- stopUpdatingTask: function (requestId) {
- if (!requestId) return false;
- var command = this.get('commands').findProperty('requestId', requestId);
- command.set('currentTaskId', null);
- return true;
- },
-
- /**
- * update info about progress of operation of commands
- */
- updateServices: function () {
- this.services.clear();
- var services = this.get("services");
- this.get("commands").forEach(function (command) {
- var polledData = command.get('polledData');
- var newService = Ember.Object.create({
- name: command.get('label'),
- hosts: []
- });
- if (polledData) {
- var hostNames = polledData.mapProperty('Tasks.host_name').uniq();
- hostNames.forEach(function (name) {
- newService.hosts.push({
- name: name,
- publicName: name,
- logTasks: polledData.filterProperty("Tasks.host_name", name)
- });
- });
- services.push(newService);
- }
- });
- this.set('serviceTimestamp', App.dateTime());
- }.observes('commands.@each.polledData'),
- /**
- * initialize default commands
- */
- loadCommands: function () {
- this.get('commands').pushObjects([
- App.Poll.create({name: 'STOP_SERVICES', label: Em.I18n.translations['admin.addSecurity.apply.stop.services'], isPolling: true }),
- App.Poll.create({name: 'APPLY_CONFIGURATIONS', label: Em.I18n.translations['admin.addSecurity.apply.save.config'], isPolling: false }),
- App.Poll.create({name: 'START_SERVICES', label: Em.I18n.translations['admin.addSecurity.apply.start.services'], isPolling: true })
- ]);
- },
-
- addObserverToCommands: function () {
- this.setIndex(this.get('commands'));
- this.addObserver('commands.@each.isSuccess', this, 'onCompleteCommand');
- },
- /**
- * set index to each command
- * @param commandArray
- */
- setIndex: function (commandArray) {
- commandArray.forEach(function (command, index) {
- command.set('index', index + 1);
- }, this);
- this.set('totalSteps', commandArray.length);
- },
-
- startCommand: function (command) {
- if (this.get('commands').length === this.get('totalSteps')) {
- if (!command) {
- var startedCommand = this.get('commands').filterProperty('isStarted', true);
- command = startedCommand.findProperty('isCompleted', false);
- }
- if (command) {
- if (command.get('isPolling')) {
- command.set('isStarted', true);
- command.start();
- } else if (command.get('name') === 'APPLY_CONFIGURATIONS') {
- command.set('isStarted', true);
- if (App.get('testMode')) {
- command.set('isError', false);
- command.set('isSuccess', true);
- } else {
- this.loadClusterConfigs();
- }
- } else if (command.get('name') === 'DELETE_ATS') {
- command.set('isStarted', true);
- if (App.get('testMode')) {
- command.set('isError', false);
- command.set('isSuccess', true);
- } else {
- var timeLineServer = App.HostComponent.find().findProperty('componentName', 'APP_TIMELINE_SERVER');
- if (timeLineServer) {
- this.deleteComponents('APP_TIMELINE_SERVER', timeLineServer.get('hostName'));
- } else {
- this.onDeleteComplete();
- }
- }
- }
- return true;
- }
- }
- return false;
- },
- /**
- * on command completion move to next command
- * @return {Boolean}
- */
- onCompleteCommand: function () {
- if (this.get('commands').length === this.get('totalSteps')) {
- var index = this.get('commands').filterProperty('isSuccess', true).length;
- if (index > 0) {
- var lastCompletedCommandResult = this.get('commands').objectAt(index - 1).get('isSuccess');
- if (lastCompletedCommandResult) {
- var nextCommand = this.get('commands').objectAt(index);
- this.moveToNextCommand(nextCommand);
- return true;
- }
- }
- }
- return false;
- },
- /**
- * move to next command
- * @param nextCommand
- */
- moveToNextCommand: function (nextCommand) {
- nextCommand = nextCommand || this.get('commands').findProperty('isStarted', false);
- if (nextCommand) {
- this.startCommand(nextCommand);
- return true;
- }
- return false;
- },
-
- /**
- * add query information(url, data) to commands
- */
- addInfoToCommands: function () {
- var operationsInfo = this.get('operationsInfo');
- var urlPrefix = App.apiPrefix + '/clusters/' + App.get('clusterName');
- operationsInfo.forEach(function (operation) {
- var command = this.get('commands').findProperty('name', operation.name);
- var url = (App.get('testMode')) ? operation.testUrl : urlPrefix + operation.realUrl;
- command.set('url', url);
- command.set('data', operation.data);
- }, this);
- },
-
- loadClusterConfigs: function () {
- App.ajax.send({
- name: 'admin.security.add.cluster_configs',
- sender: this,
- success: 'loadClusterConfigsSuccessCallback',
- error: 'loadClusterConfigsErrorCallback'
- });
- },
-
- loadClusterConfigsSuccessCallback: function (data) {
- //prepare tags to fetch all configuration for a service
- this.get('secureServices').forEach(function (_secureService) {
- this.setServiceTagNames(_secureService, data.Clusters.desired_configs);
- }, this);
- this.getAllConfigurations();
- },
-
- loadClusterConfigsErrorCallback: function (request, ajaxOptions, error) {
- var command = this.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- command.set('isSuccess', false);
- command.set('isError', true);
- console.log("TRACE: error code status is: " + request.status);
- },
-
- /**
- * set tag names according to installed services and desired configs
- * @param secureService
- * @param configs
- * @return {Object}
- */
- setServiceTagNames: function (secureService, configs) {
- //var serviceConfigTags = this.get('serviceConfigTags');
- for (var index in configs) {
- if (secureService.sites && secureService.sites.contains(index)) {
- var serviceConfigObj = {
- siteName: index,
- tagName: configs[index].tag,
- newTagName: null,
- configs: {}
- };
- this.get('serviceConfigTags').pushObject(serviceConfigObj);
- }
- }
- return serviceConfigObj;
- },
-
- /**
- * form query data and apply security configurations to server
- */
- applyConfigurationsToCluster: function () {
- var configData = this.get('serviceConfigTags').map(function (_serviceConfig) {
- var res = {
- type: _serviceConfig.siteName,
- tag: _serviceConfig.newTagName,
- properties: _serviceConfig.configs,
- service_config_version_note: Em.I18n.t('admin.security.step4.save.configuration.note')
- };
- if (_serviceConfig.properties_attributes) {
- res['properties_attributes'] = _serviceConfig.properties_attributes
- }
- return res;
- }, this);
-
- var selectedServices = this.get('secureServices');
- var allConfigData = [];
- selectedServices.forEach(function (service) {
- var stackService = App.StackService.find(service.serviceName);
- if (stackService) {
- var serviceConfigData = [];
- Object.keys(stackService.get('configTypesRendered')).forEach(function (type) {
- var serviceConfigTag = configData.findProperty('type', type);
- if (serviceConfigTag) {
- serviceConfigData.pushObject(serviceConfigTag);
- }
- }, this);
- allConfigData.pushObject(JSON.stringify({
- Clusters: {
- desired_config: serviceConfigData
- }
- }));
- }
- }, this);
-
- var clusterConfig = configData.findProperty('type', 'cluster-env');
- if (clusterConfig) {
- allConfigData.pushObject(JSON.stringify({
- Clusters: {
- desired_config: [clusterConfig]
- }
- }));
- }
- App.ajax.send({
- name: 'common.across.services.configurations',
- sender: this,
- data: {
- data: '[' + allConfigData.toString() + ']'
- },
- success: 'applyConfigurationToClusterSuccessCallback',
- error: 'applyConfigurationToClusterErrorCallback'
- });
- },
-
- applyConfigurationToClusterSuccessCallback: function (data) {
- var command = this.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- command.set('isSuccess', true);
- command.set('isError', false);
- },
-
- applyConfigurationToClusterErrorCallback: function (request, ajaxOptions, error) {
- var command = this.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- command.set('isSuccess', false);
- command.set('isError', true);
- },
-
- /**
- * gets site config properties from server and sets it for every configuration
- */
- getAllConfigurations: function () {
- var urlParams = [];
- this.get('serviceConfigTags').forEach(function (_tag) {
- urlParams.push('(type=' + _tag.siteName + '&tag=' + _tag.tagName + ')');
- }, this);
- if (urlParams.length > 0) {
- App.ajax.send({
- name: 'admin.get.all_configurations',
- sender: this,
- data: {
- urlParams: urlParams.join('|')
- },
- success: 'getAllConfigurationsSuccessCallback',
- error: 'getAllConfigurationsErrorCallback'
- });
- }
- },
-
- getAllConfigurationsSuccessCallback: function (data) {
- console.log("TRACE: In success function for the GET getServiceConfigsFromServer call");
- var command = this.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- this.get('serviceConfigTags').forEach(function (_tag) {
- if (!data.items.someProperty('type', _tag.siteName)) {
- console.log("Error: Metadata for secure services (secure_configs.js) is having config tags that are not being retrieved from server");
- command.set('isSuccess', false);
- command.set('isError', true);
- }
- var cfg = data.items.findProperty('type', _tag.siteName);
- _tag.configs = this.modifyConfigsForSecure(_tag.siteName, cfg);
- if (cfg.properties_attributes) {
- _tag.properties_attributes = cfg.properties_attributes;
- }
- }, this);
- if (this.manageSecureConfigs()) {
- this.applyConfigurationsToCluster();
- }
- },
-
- propertiesToUpdate: [
- {
- siteName: 'storm-site',
- name: 'ui.childopts',
- append: ' -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf'
- },
- {
- siteName: 'storm-site',
- name: 'supervisor.childopts',
- append: ' -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf'
- },
- {
- siteName: 'storm-site',
- name: 'nimbus.childopts',
- append: ' -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf'
- }
- ],
-
- /**
- * updates some configs for correct work in secure mode
- * @method modifyConfigsForSecure
- * @param {String} siteName
- * @param {Object} cfg
- * {
- * properties: {
- * 'ui.childopts': 'value1'
- * 'property2': 'value2'
- * }
- * };
- * has other properties but required filed is "properties";
- * @returns {Object}
- * properties: {
- * 'ui.childopts': 'value1 -Djava.security.auth.login.config=/etc/storm/conf/storm_jaas.conf'
- * 'property2': 'value2'
- * }
- */
- modifyConfigsForSecure: function(siteName, cfg) {
- var propertiesToUpdate = this.get('propertiesToUpdate').filterProperty('siteName', siteName);
- if (propertiesToUpdate.length) {
- propertiesToUpdate.forEach(function(p) {
- cfg.properties[p.name] += p.append;
- }, this);
- }
- return cfg.properties
- },
-
- getAllConfigurationsErrorCallback: function (request, ajaxOptions, error) {
- var command = this.get('commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- command.set('isSuccess', false);
- command.set('isError', true);
- console.log("TRACE: In error function for the getServiceConfigsFromServer call");
- console.log("TRACE: error code status is: " + request.status);
- },
-
- /**
- * save commands to server and local storage
- */
- saveCommands: function () {
- var commands = [];
- if (this.get('commands').length === this.get('totalSteps')) {
- this.get('commands').forEach(function (_command) {
- var command = {
- name: _command.get('name'),
- label: _command.get('label'),
- isPolling: _command.get('isPolling'),
- isVisible: _command.get('isVisible'),
- isStarted: _command.get('isStarted'),
- requestId: _command.get('requestId'),
- isSuccess: _command.get('isSuccess'),
- isError: _command.get('isError'),
- url: _command.get('url'),
- polledData: _command.get('polledData'),
- data: _command.get('data')
- };
- commands.pushObject(command);
- }, this);
- App.db.setSecurityDeployCommands(commands);
- if (!App.get('testMode')) {
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('clusterName'),
- clusterState: 'ADD_SECURITY_STEP_4',
- wizardControllerName: App.router.get('addSecurityController.name'),
- localdb: App.db.data
- });
- }
- }
- }.observes('commands.@each.isCompleted', 'commands.@each.requestId')
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/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 144465b..c0678f2 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -436,15 +436,6 @@ App.MainHostDetailsController = Em.Controller.extend({
batchUtils.restartHostComponents([component], Em.I18n.t('rollingrestart.context.selectedComponentOnSelectedHost').format(component.get('displayName')), "HOST_COMPONENT");
});
},
- /**
- * get current status of security settings,
- * if true security is enabled otherwise disabled
- * @return {Boolean}
- */
- securityEnabled: function () {
- return App.router.get('mainAdminSecurityController.securityEnabled');
- }.property('App.router.mainAdminSecurityController.securityEnabled'),
-
/**
* add component as <code>addComponent<code> method but perform
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/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 3cf8f56..be8aeab 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -58,14 +58,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E
secureConfigs: require('data/HDP2/secure_mapping'),
/**
- * config categories with secure properties
- * use only for add service wizard when security is enabled;
- */
- secureServices: function () {
- return $.extend(true, [], require('data/HDP2/secure_configs'));
- }.property(),
-
- /**
* uses for add service - find out is security is enabled
*/
securityEnabled: function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/data/HDP2/secure_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/secure_configs.js b/ambari-web/app/data/HDP2/secure_configs.js
deleted file mode 100644
index bac785f..0000000
--- a/ambari-web/app/data/HDP2/secure_configs.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * 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');
-require('models/configs/objects/service_config');
-require('models/configs/objects/service_config_category');
-require('models/configs/objects/service_config_property');
-require('models/service');
-
-App.SecureConfigProperties = Ember.ArrayProxy.extend({
- content: require('data/HDP2/secure_properties').configProperties
-});
-
-var configProperties = App.SecureConfigProperties.create();
-
-var configs = [
- {
- serviceName: 'GENERAL',
- displayName: 'General',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'KERBEROS', displayName: 'Kerberos'}),
- App.ServiceConfigCategory.create({ name: 'AMBARI', displayName: 'Ambari'})
- ],
- sites: ['cluster-env'],
- configs: configProperties.filterProperty('serviceName', 'GENERAL')
- },
- {
- serviceName: 'HDFS',
- displayName: 'HDFS',
- filename: 'hdfs-site',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'General', displayName: 'General', exclude:'HA'}),
- App.ServiceConfigCategory.create({ name: 'NameNode', displayName: 'NameNode'}),
- App.ServiceConfigCategory.create({ name: 'SNameNode', displayName: 'Secondary NameNode',exclude:'HA'}),
- App.ServiceConfigCategory.create({ name: 'JournalNode', displayName: 'JournalNode',exclude:'non-HA'}),
- App.ServiceConfigCategory.create({ name: 'DataNode', displayName: 'DataNode'})
- ],
- sites: ['hadoop-env','core-site', 'hdfs-site'],
- configs: configProperties.filterProperty('serviceName', 'HDFS')
- },
- {
- serviceName: 'MAPREDUCE2',
- displayName: 'MapReduce2',
- filename: 'mapred-site',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'JobHistoryServer', displayName: 'History Server'})
- ],
- sites: ['mapred-site'],
- configs: configProperties.filterProperty('serviceName', 'MAPREDUCE2')
- },
- {
- serviceName: 'YARN',
- displayName: 'YARN',
- filename: 'yarn-site',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'ResourceManager', displayName : 'ResourceManager'}),
- App.ServiceConfigCategory.create({ name: 'NodeManager', displayName : 'NodeManager'})
- ], // these properties can be dynamic
- sites: ['yarn-site', 'core-site'],
- configs: configProperties.filterProperty('serviceName', 'YARN')
- },
- {
- serviceName: 'HIVE',
- displayName: 'Hive',
- filename: 'hive-site',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'Hive Metastore', displayName: 'Hive Metastore and Hive Server 2'}),
- App.ServiceConfigCategory.create({ name: 'WebHCat Server', displayName : 'WebHCat Server'})
- ],
- sites: ['hive-site','webhcat-site'],
- configs: configProperties.filterProperty('serviceName', 'HIVE')
- },
- {
- serviceName: 'HBASE',
- displayName: 'HBase',
- filename: 'hbase-site',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'HBase Master', displayName: 'HBase Master'}),
- App.ServiceConfigCategory.create({ name: 'RegionServer', displayName: 'RegionServer'})
- ],
- sites: ['hbase-env','hbase-site'],
- configs: configProperties.filterProperty('serviceName', 'HBASE')
- },
- {
- serviceName: 'ZOOKEEPER',
- displayName: 'ZooKeeper',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'ZooKeeper Server', displayName: 'ZooKeeper Server'})
- ],
- sites: ['zookeeper-env'],
- configs: configProperties.filterProperty('serviceName', 'ZOOKEEPER')
-
- },
- {
- serviceName: 'OOZIE',
- displayName: 'Oozie',
- filename: 'oozie-site',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'Oozie Server', displayName: 'Oozie Server'})
- ],
- sites: ['oozie-env','oozie-site'],
- configs: configProperties.filterProperty('serviceName', 'OOZIE')
- },
- {
- serviceName: 'STORM',
- displayName: 'Storm',
- filename: 'storm-site',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'Storm Topology', displayName: 'Storm Client'})
- ],
- sites: ['storm-env','storm-site'],
- configs: configProperties.filterProperty('serviceName', 'STORM')
- },
- {
- serviceName: 'FALCON',
- displayName: 'Falcon',
- filename: 'falcon-startup.properties',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'Falcon Server', displayName: 'Falcon Server startup properties'})
- ],
- sites: ['falcon-startup.properties'],
- configs: configProperties.filterProperty('serviceName', 'FALCON')
- },
- {
- serviceName: 'KNOX',
- displayName: 'Knox',
- filename: 'gateway-site.xml',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'Knox Gateway', displayName: 'Knox Gateway'})
- ],
- sites: ['gateway-site','knox-env'],
- configs: configProperties.filterProperty('serviceName', 'KNOX')
- }
-];
-
-if(App.get('isHadoop22Stack')){
- for(var i = 0; i < configs.length; i++){
- var config = configs[i];
- if( config.serviceName === 'STORM' ){
- config.configCategories.unshift(App.ServiceConfigCategory.create({ name: 'Nimbus', displayName: 'Nimbus'}));
- }
- }
-}
-
-
-module.exports = configs;
-
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/data/HDP2/secure_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2/secure_properties.js b/ambari-web/app/data/HDP2/secure_properties.js
deleted file mode 100644
index bb4560d..0000000
--- a/ambari-web/app/data/HDP2/secure_properties.js
+++ /dev/null
@@ -1,1268 +0,0 @@
-/**
- * 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.
- */
-
-
-/*
- * Description of fields:
- * name: has to coincide with how the property will be saved to the file
- * displayName: how it will be shown in the Admin Security Wizard
- * serviceName: the tab in which it will appear in the Admin Security Wizard
- * filename: the file it is saved to, and the section of the command-#.json file
- * category: the accordion name in the tab shown in the Admin Security Wizard
- * component: Ambari component name
- */
-
-var props = {
- "configProperties": [
- {
- "id": "puppet var",
- "name": "security_enabled",
- "displayName": "Enable security",
- "value": "",
- "recommendedValue": 'true',
- "description": "Enable kerberos security for the cluster",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "GENERAL",
- "filename": "cluster-env.xml",
- "category": "KERBEROS"
- },
- {
- "id": "puppet var",
- "name": "kerberos_install_type",
- "displayName": "Type of security",
- "value": "",
- "recommendedValue": "MANUALLY_SET_KERBEROS",
- "description": "Type of kerberos security for the cluster",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "GENERAL",
- "category": "KERBEROS"
- },
- {
- "id": "puppet var",
- "name": "kerberos_domain",
- "displayName": "Realm name",
- "value": "",
- "recommendedValue": "EXAMPLE.COM",
- "description": "Realm name to be used for all principal names",
- "displayType": "advanced",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "GENERAL",
- "filename": "cluster-env.xml",
- "category": "KERBEROS"
- },
- {
- "id": "puppet var",
- "name": "kinit_path_local",
- "displayName": "Kerberos tool path",
- "value": "",
- "recommendedValue": "/usr/bin",
- "description": "Directoy path to installed kerberos tools like kinit, kdestroy etc. This can have multiple comma delimited paths",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "GENERAL",
- "filename": "cluster-env.xml",
- "category": "KERBEROS"
- },
- {
- "id": "puppet var",
- "name": "smokeuser_principal_name",
- "displayName": "Smoke test user principal",
- "value": "",
- "recommendedValue": "ambari-qa",
- "description": "This is the principal name for Smoke test user",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "isReconfigurable": false,
- "serviceName": "GENERAL",
- "category": "AMBARI"
- },
- {
- "id": "puppet var",
- "name": "smokeuser_keytab",
- "displayName": "Path to smoke test user keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/smokeuser.headless.keytab",
- "description": "Path to keytab file for smoke test user",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "GENERAL",
- "filename": "cluster-env.xml",
- "category": "AMBARI"
- },
- {
- "id": "puppet var",
- "name": "hdfs_principal_name",
- "displayName": "HDFS user principal",
- "value": "",
- "recommendedValue": "hdfs",
- "description": "This is the principal name for HDFS user",
- "displayType": "principal",
- "isVisible": false,
- "isOverridable": false,
- "isReconfigurable": false,
- "serviceName": "GENERAL",
- "filename": "hadoop-env.xml",
- "category": "AMBARI"
- },
- {
- "id": "puppet var",
- "name": "hdfs_user_keytab",
- "displayName": "Path to HDFS user keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/hdfs.headless.keytab",
- "description": "Path to keytab file for HDFS user",
- "displayType": "directory",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "GENERAL",
- "filename": "hadoop-env.xml",
- "category": "AMBARI"
- },
- {
- "id": "puppet var",
- "name": "hbase_principal_name",
- "displayName": "HBase user principal",
- "value": "",
- "recommendedValue": "hbase",
- "description": "This is the principal name for HBase user",
- "displayType": "principal",
- "isVisible": false,
- "isOverridable": false,
- "isReconfigurable": false,
- "serviceName": "GENERAL",
- "filename": "hbase-env.xml",
- "category": "AMBARI"
- },
- {
- "id": "puppet var",
- "name": "hbase_user_keytab",
- "displayName": "Path to HBase user keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/hbase.headless.keytab",
- "description": "Path to keytab file for Hbase user",
- "displayType": "directory",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "GENERAL",
- "filename": "hbase-env.xml",
- "category": "AMBARI"
- },
-
- /**********************************************HDFS***************************************/
- {
- "id": "puppet var",
- "name": "namenode_host",
- "displayName": "NameNode hosts",
- "value": "",
- "recommendedValue": "",
- "description": "The hosts that has been assigned to run NameNode",
- "displayType": "masterHosts",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "HDFS",
- "category": "NameNode"
- },
- {
- "id": "puppet var",
- "name": "namenode_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "nn/_HOST",
- "description": "Principal name for NameNode. _HOST will get automatically replaced with actual hostname at an instance of NameNode",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "NameNode",
- "components": ["NAMENODE"]
- },
- {
- "id": "puppet var",
- "name": "namenode_keytab",
- "displayName": "Path to Keytab File",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/nn.service.keytab",
- "description": "Path to NameNode keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "NameNode",
- "components": ["NAMENODE"]
- },
- {
- "id": "puppet var",
- "name": "snamenode_host",
- "displayName": "SNameNode host",
- "value": "",
- "recommendedValue": "localhost",
- "description": "The host that has been assigned to run SecondaryNameNode",
- "displayType": "masterHost",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "HDFS",
- "category": "SNameNode"
- },
- {
- "id": "puppet var",
- "name": "snamenode_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "nn/_HOST",
- "description": "Principal name for SNameNode. _HOST will get automatically replaced with actual hostname at an instance of SNameNode",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "SNameNode",
- "components": ["SECONDARY_NAMENODE"]
- },
- {
- "id": "puppet var",
- "name": "snamenode_keytab",
- "displayName": "Path to Keytab File",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/nn.service.keytab",
- "description": "Path to SNameNode keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "SNameNode",
- "components": ["SECONDARY_NAMENODE"]
- },
- {
- "id": "puppet var",
- "name": "journalnode_hosts",
- "displayName": "JournalNode hosts",
- "value": "",
- "recommendedValue": "localhost",
- "description": "The hosts that have been assigned to run JournalNodes",
- "displayType": "masterHosts",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "HDFS",
- "category": "JournalNode"
- },
- {
- "id": "puppet var",
- "name": "journalnode_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "jn/_HOST",
- "description": "Principal name for JournalNode. _HOST will get automatically replaced with actual hostname at every instance of JournalNode",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "JournalNode",
- "component": "JOURNALNODE"
- },
- {
- "id": "puppet var",
- "name": "journalnode_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/jn.service.keytab",
- "description": "Path to JournalNode keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "JournalNode",
- "component": "JOURNALNODE"
- },
- {
- "id": "puppet var",
- "name": "datanode_hosts", //not in the schema. For UI purpose
- "displayName": "DataNode hosts",
- "value": "",
- "recommendedValue": "",
- "description": "The hosts that have been assigned to run DataNode",
- "displayType": "slaveHosts",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "HDFS",
- "category": "DataNode"
- },
- {
- "id": "puppet var",
- "name": "dfs_datanode_address",
- "displayName": "Datanode address",
- "value": "",
- "recommendedValue": "1019",
- "description": "Address for DataNode",
- "displayType": "principal",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "DataNode"
- },
- {
- "id": "puppet var",
- "name": "dfs_datanode_http_address",
- "displayName": "Datanode HTTP address",
- "value": "",
- "recommendedValue": "1022",
- "description": "Address for DataNode",
- "displayType": "principal",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "DataNode"
- },
- {
- "id": "puppet var",
- "name": "datanode_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "dn/_HOST",
- "description": "Principal name for DataNode. _HOST will get automatically replaced with actual hostname at every instance of DataNode",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "DataNode",
- "component": "DATANODE"
- },
- {
- "id": "puppet var",
- "name": "datanode_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/dn.service.keytab",
- "description": "Path to DataNode keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "DataNode",
- "component": "DATANODE"
- },
- {
- "id": "puppet var",
- "name": "hadoop_http_principal_name",
- "displayName": "DFS web principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access for HDFS components. _HOST will get automatically replaced with actual hostname at instance of HDFS component",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "General"
- },
- {
- "id": "puppet var",
- "name": "hadoop_http_keytab",
- "displayName": "Path to SPNEGO keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for NameNode and SNameNode",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HDFS",
- "category": "General"
- },
-
- /**********************************************MAPREDUCE2***************************************/
- {
- "id": "puppet var",
- "name": "jobhistoryserver_host",
- "displayName": "History Server host",
- "value": "",
- "recommendedValue": "",
- "description": "The host that has been assigned to run History Server",
- "displayType": "masterHost",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "MAPREDUCE2",
- "category": "JobHistoryServer"
- },
- {
- "id": "puppet var",
- "name": "jobhistory_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "jhs/_HOST",
- "description": "Principal name for History Server. _HOST will get automatically replaced with actual hostname at an instance of History Server",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "MAPREDUCE2",
- "category": "JobHistoryServer",
- "component": "HISTORYSERVER"
- },
- {
- "id": "puppet var",
- "name": "jobhistory_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/jhs.service.keytab",
- "description": "Path to History Server keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "MAPREDUCE2",
- "category": "JobHistoryServer",
- "component": "HISTORYSERVER"
- },
- {
- "id": "puppet var",
- "name": "jobhistory_http_principal_name",
- "displayName": "Web principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access to Job History Server. _HOST will get automatically replaced with actual hostname at an instance of Job History Server",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "MAPREDUCE2",
- "category": "JobHistoryServer"
- },
- {
- "id": "puppet var",
- "name": "jobhistory_http_keytab",
- "displayName": "Path to SPNEGO keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for Job History Server",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "MAPREDUCE2",
- "category": "JobHistoryServer"
- },
-
- /**********************************************YARN***************************************/
- {
- "id": "puppet var",
- "name": "resourcemanager_host",
- "displayName": "ResourceManager host",
- "value": "",
- "recommendedValue": "",
- "description": "The host that has been assigned to run ResourceManager",
- "displayType": "masterHost",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "YARN",
- "category": "ResourceManager"
- },
- // YARN Application Timeline Server
- {
- "id": "puppet var",
- "name": "apptimelineserver_host",
- "displayName": "Application Timeline Server host",
- "value": "",
- "recommendedValue": "",
- "description": "The host that has been assigned to run AppTimelineServer",
- "displayType": "masterHost",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "YARN",
- "category": "AppTimelineServer"
- },
- {
- "id": "puppet var",
- "name": "apptimelineserver_principal_name",
- "displayName": "App Timeline Server Principal name",
- "value": "",
- "recommendedValue": "yarn/_HOST",
- "description": "Principal name for App Timeline Server. _HOST will get automatically replaced with actual hostname at an instance of App Timeline Server",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": true,
- "serviceName": "YARN",
- "category": "AppTimelineServer",
- "component": "APP_TIMELINE_SERVER"
- },
- {
- "id": "puppet var",
- "name": "apptimelineserver_keytab",
- "displayName": "Path to App Timeline Server keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/yarn.service.keytab",
- "description": "Path to App Timeline Server keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": true,
- "serviceName": "YARN",
- "category": "AppTimelineServer",
- "component": "APP_TIMELINE_SERVER"
- },
- {
- "id": "puppet var",
- "name": "apptimelineserver_http_principal_name",
- "displayName": "App Timeline Server HTTP Principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for App Timeline Server HTTP. _HOST will get automatically replaced with actual hostname at an instance of App Timeline Server",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": true,
- "serviceName": "YARN",
- "category": "AppTimelineServer"
- },
- {
- "id": "puppet var",
- "name": "apptimelineserver_http_keytab",
- "displayName": "Path to App Timeline Server SPNEGO HTTP keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to App Timeline Server SPNEGO HTTP keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": true,
- "serviceName": "YARN",
- "category": "AppTimelineServer"
- },
-
- // YARN Resource Manager
- {
- "id": "puppet var",
- "name": "resourcemanager_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "rm/_HOST",
- "description": "Principal name for ResourceManager. _HOST will get automatically replaced with actual hostname at an instance of ResourceManager",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "ResourceManager",
- "component": "RESOURCEMANAGER"
- },
- {
- "id": "puppet var",
- "name": "resourcemanager_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/rm.service.keytab",
- "description": "Path to ResourceManager keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "ResourceManager",
- "component": "RESOURCEMANAGER"
- },
- {
- "id": "puppet var",
- "name": "resourcemanager_http_principal_name",
- "displayName": "Web principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access to ResourceManager. _HOST will get automatically replaced with actual hostname at an instance of ResourceManager",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "ResourceManager"
- },
- {
- "id": "puppet var",
- "name": "resourcemanager_http_keytab",
- "displayName": "Path to SPNEGO keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for ResourceManager",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "ResourceManager"
- },
- {
- "id": "puppet var",
- "name": "nodemanager_host",
- "displayName": "NodeManager hosts",
- "value": "",
- "recommendedValue": "",
- "description": "The hosts that has been assigned to run NodeManager",
- "displayType": "slaveHosts",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "YARN",
- "category": "NodeManager"
- },
- {
- "id": "puppet var",
- "name": "nodemanager_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "nm/_HOST",
- "description": "Principal name for NodeManager. _HOST will get automatically replaced with actual hostname at all instances of NodeManager",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "NodeManager",
- "component": "NODEMANAGER"
- },
- {
- "id": "puppet var",
- "name": "nodemanager_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/nm.service.keytab",
- "description": "Path to NodeManager keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "NodeManager",
- "component": "NODEMANAGER"
- },
- {
- "id": "puppet var",
- "name": "nodemanager_http_principal_name",
- "displayName": "Web principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access to NodeManager. _HOST will get automatically replaced with actual hostname at all instances of NodeManager",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "NodeManager"
- },
- {
- "id": "puppet var",
- "name": "nodemanager_http_keytab",
- "displayName": "Path to SPNEGO keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for NodeManager",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "NodeManager"
- },
- {
- "id": "puppet var",
- "name": "yarn_nodemanager_container-executor_class",
- "displayName": "yarn.nodemanager.container-executor.class",
- "value": "",
- "recommendedValue": "org.apache.hadoop.yarn.server.nodemanager.LinuxContainerExecutor",
- "description": "Executor(launcher) of the containers",
- "displayType": "advanced",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "YARN",
- "category": "NodeManager"
- },
- {
- "id": "puppet var",
- "name": "webhcatserver_host",
- "displayName": "WebHCat Server host",
- "value": "",
- "recommendedValue": "localhost",
- "description": "The host that has been assigned to run WebHCat Server",
- "displayType": "masterHost",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "WebHCat Server"
- },
- {
- "id": "puppet var",
- "name": "webHCat_http_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access for WebHCat",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "WebHCat Server"
- },
- {
- "id": "puppet var",
- "name": "webhcat_http_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for WebHCat",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "WebHCat Server"
- },
-
- /**********************************************HBASE***************************************/
- {
- "id": "puppet var",
- "name": "hbasemaster_host",
- "displayName": "HBase Master hosts",
- "value": "",
- "recommendedValue": "",
- "description": "The host that has been assigned to run HBase Master",
- "displayType": "masterHosts",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "HBASE",
- "category": "HBase Master"
- },
- {
- "id": "puppet var",
- "name": "hbase_master_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "hbase/_HOST",
- "description": "Principal name for HBase master. _HOST will get automatically replaced with actual hostname at an instance of HBase Master",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HBASE",
- "category": "HBase Master",
- "components": ["HBASE_MASTER"]
- },
- {
- "id": "puppet var",
- "name": "hbase_master_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/hbase.service.keytab",
- "description": "Path to HBase master keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HBASE",
- "category": "HBase Master",
- "components": ["HBASE_MASTER"]
- },
- {
- "id": "puppet var",
- "name": "regionserver_hosts",
- "displayName": "RegionServer hosts",
- "value": "",
- "recommendedValue": "",
- "description": "The hosts that have been assigned to run RegionServer",
- "displayType": "slaveHosts",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "HBASE",
- "category": "RegionServer"
- },
- {
- "id": "puppet var",
- "name": "hbase_regionserver_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "hbase/_HOST",
- "description": "Principal name for RegionServer. _HOST will get automatically replaced with actual hostname at every instance of RegionServer",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HBASE",
- "category": "RegionServer",
- "components": ["HBASE_REGIONSERVER"]
- },
- {
- "id": "puppet var",
- "name": "hbase_regionserver_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/hbase.service.keytab",
- "description": "Path to RegionServer keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HBASE",
- "category": "RegionServer",
- "components": ["HBASE_REGIONSERVER"]
- },
-
- /**********************************************HIVE***************************************/
- {
- "id": "puppet var",
- "name": "hive_metastore",
- "displayName": "Hive Metastore hosts",
- "value": "",
- "recommendedValue": "localhost",
- "description": "The hosts that have been assigned to run Hive Metastore and HiveServer2",
- "displayType": "masterHosts",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "Hive Metastore"
- },
- {
- "id": "puppet var",
- "name": "hive_metastore_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "hive/_HOST",
- "description": "Principal name for Hive Metastore and HiveServer2. _HOST will get automatically replaced with actual hostname at an instance of Hive Metastore and HiveServer2",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "Hive Metastore",
- "components": ["HIVE_SERVER", "HIVE_METASTORE"]
- },
- {
- "id": "puppet var",
- "name": "hive_metastore_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/hive.service.keytab",
- "description": "Path to Hive Metastore and HiveServer2 keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "Hive Metastore",
- "components": ["HIVE_SERVER", "HIVE_METASTORE"]
- },
- {
- "id": "puppet var",
- "name": "hive_metastore_http_principal_name",
- "displayName": "Web principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access to Hive Metastore and HiveServer2. _HOST will get automatically replaced with actual hostname at an instance of Hive Metastore and HiveServer2",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "Hive Metastore"
- },
- {
- "id": "puppet var",
- "name": "hive_metastore_http_keytab",
- "displayName": "Path to SPNEGO keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for Hive Metastore and HiveServer2",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "HIVE",
- "category": "Hive Metastore"
- },
-
- /**********************************************OOZIE***************************************/
- {
- "id": "puppet var",
- "name": "oozie_servername",
- "displayName": "Oozie Server host",
- "value": "",
- "recommendedValue": "localhost",
- "description": "Oozie server host name",
- "displayType": "masterHost",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "OOZIE",
- "category": "Oozie Server"
- },
- {
- "id": "puppet var",
- "name": "oozie_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "oozie/_HOST",
- "description": "Principal name for Oozie server",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "OOZIE",
- "category": "Oozie Server",
- "component": "OOZIE_SERVER"
- },
- {
- "id": "puppet var",
- "name": "oozie_keytab",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/oozie.service.keytab",
- "description": "Path to Oozie server keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "OOZIE",
- "filename": "oozie-env.xml",
- "category": "Oozie Server",
- "component": "OOZIE_SERVER"
- },
- {
- "id": "puppet var",
- "name": "oozie_http_principal_name",
- "displayName": "Web principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access to Oozie",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "OOZIE",
- "category": "Oozie Server"
- },
- {
- "id": "puppet var",
- "name": "oozie_http_keytab",
- "displayName": "Path to SPNEGO keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for oozie",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "OOZIE",
- "category": "Oozie Server"
- },
-
- /**********************************************ZOOKEEPER***************************************/
- {
- "id": "puppet var",
- "name": "zookeeperserver_hosts",
- "displayName": "ZooKeeper Server hosts",
- "value": "",
- "recommendedValue": "",
- "description": "The host that has been assigned to run ZooKeeper Server",
- "displayType": "masterHosts",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "ZOOKEEPER",
- "category": "ZooKeeper Server"
- },
- {
- "id": "puppet var",
- "name": "zookeeper_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "zookeeper/_HOST",
- "description": "Principal name for ZooKeeper. _HOST will get automatically replaced with actual hostname at every instance of zookeeper server",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "ZOOKEEPER",
- "filename": "zookeeper-env.xml",
- "category": "ZooKeeper Server",
- "component": "ZOOKEEPER_SERVER"
- },
- {
- "id": "puppet var",
- "name": "zookeeper_keytab_path",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/zk.service.keytab",
- "description": "Path to ZooKeeper keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "ZOOKEEPER",
- "filename": "zookeeper-env.xml",
- "category": "ZooKeeper Server",
- "component": "ZOOKEEPER_SERVER"
- },
- /**********************************************Falcon***************************************/
- {
- "id": "puppet var",
- "name": "falcon_server_host",
- "displayName": "Falcon server host",
- "value": "",
- "recommendedValue": "",
- "description": "Falcon Server host",
- "displayType": "masterHost",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "FALCON",
- "category": "Falcon Server"
- },
- {
- "id": "puppet var",
- "name": "falcon_principal_name",
- "displayName": "Falcon principal name",
- "value": "",
- "recommendedValue": "falcon/_HOST",
- "description": "This is the principal name for Falcon Server",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "FALCON",
- "category": "Falcon Server",
- "component": "FALCON_SERVER"
- },
- {
- "id": "puppet var",
- "name": "falcon_keytab",
- "displayName": "Path to Falcon server keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/falcon.service.keytab",
- "description": "Path to the Falcon Server keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "FALCON",
- "category": "Falcon Server",
- "component": "FALCON_SERVER"
- },
- {
- "id": "puppet var",
- "name": "falcon_http_principal_name",
- "displayName": "Web principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for SPNEGO access to Falcon",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "FALCON",
- "category": "Falcon Server"
- },
- {
- "id": "puppet var",
- "name": "falcon_http_keytab",
- "displayName": "Path to SPNEGO keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to SPNEGO keytab file for Falcon",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "FALCON",
- "category": "Falcon Server"
- },
- {
- "id": "puppet var",
- "name": "namenode_principal_name_falcon",
- "displayName": "NameNode principal name",
- "value": "",
- "recommendedValue": "nn/_HOST",
- "description": "NameNode principal to talk to config store",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "FALCON",
- "category": "Falcon Server"
- },
-
- /**********************************************Knox***************************************/
- {
- "id": "puppet var",
- "name": "knox_gateway_hosts",
- "displayName": "Knox Gateway hosts",
- "value": "",
- "recommendedValue": "",
- "description": "The hosts that has been assigned to run Knox Gateway",
- "displayType": "masterHosts",
- "isOverridable": false,
- "isVisible": true,
- "serviceName": "KNOX",
- "category": "Knox Gateway"
- },
- {
- "id": "puppet var",
- "name": "knox_principal_name",
- "displayName": "Principal name",
- "value": "",
- "recommendedValue": "knox/_HOST",
- "description": "This is the principal name for Knox Gateway",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "KNOX",
- "filename": "knox-env.xml",
- "category": "Knox Gateway",
- "component": "KNOX_GATEWAY"
- },
- {
- "id": "puppet var",
- "name": "knox_keytab_path",
- "displayName": "Path to keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/knox.service.keytab",
- "description": "This is the keytab file for Knox Gateway",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "KNOX",
- "filename": "knox-env.xml",
- "category": "Knox Gateway",
- "component": "KNOX_GATEWAY"
- }
- ]
-};
-
-var stormProperties = [
- {
- "id": "puppet var",
- "name": "storm_host",
- "displayName": "Storm component hosts",
- "value": "",
- "recommendedValue": "",
- "description": "Storm component hosts",
- "displayType": "slaveHosts",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "category": "Storm Topology"
- },
- {
- "id": "puppet var",
- "name": "storm_principal_name",
- "displayName": " Storm principal name",
- "value": "",
- "recommendedValue": "storm/_HOST",
- "description": "Principal name for Supervisor. _HOST will get automatically replaced with actual hostname at an instance of every storm component.",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Storm Topology",
- "components": ["SUPERVISOR", "NIMBUS", "STORM_UI_SERVER"]
- },
- {
- "id": "puppet var",
- "name": "storm_keytab",
- "displayName": "Path to Storm keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/storm.service.keytab",
- "description": "Path to the storm keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Storm Topology",
- "components": ["SUPERVISOR", "NIMBUS"]
- }
-];
-var storm22Properties = [
- {
- "id": "puppet var",
- "name": "storm_principal_name",
- "displayName": " Storm principal name",
- "value": "",
- "recommendedValue": "storm/_HOST",
- "description": "Principal name for Storm components. _HOST will get automatically replaced with actual hostname at an instance of every storm component.",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Storm Topology",
- "components": ["SUPERVISOR", "STORM_UI_SERVER", "DRPC_SERVER", "STORM_REST_API"]
- },
- {
- "id": "puppet var",
- "name": "storm_keytab",
- "displayName": "Path to Storm keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/storm.service.keytab",
- "description": "Path to the storm keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Storm Topology",
- "components": ["SUPERVISOR", "STORM_UI_SERVER", "DRPC_SERVER", "STORM_REST_API"]
- },
- {
- "id": "puppet var",
- "name": "nimbus_host",
- "displayName": "Nimbus hosts",
- "value": "",
- "recommendedValue": "",
- "description": "Nimbus component hosts",
- "displayType": "slaveHosts",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "category": "Nimbus"
- },
- {
- "id": "puppet var",
- "name": "nimbus_principal_name",
- "displayName": " Nimbus principal name",
- "value": "",
- "recommendedValue": "nimbus/_HOST",
- "description": "Nimbus Principal name",
- "displayType": "principal",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Nimbus",
- "components": ["NIMBUS","DRPC_SERVER"]
- },
- {
- "id": "puppet var",
- "name": "nimbus_keytab",
- "displayName": "Path to Nimbus keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/nimbus.service.keytab",
- "description": "Path to the nimbus keytab file",
- "displayType": "directory",
- "isVisible": true,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Nimbus",
- "components": ["NIMBUS","DRPC_SERVER"]
- },
- {
- "id": "puppet var",
- "name": "storm_ui_principal_name",
- "displayName": "Storm UI principal name",
- "value": "",
- "recommendedValue": "HTTP/_HOST",
- "description": "Principal name for Storm UI",
- "displayType": "principal",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Nimbus"
- },
- {
- "id": "puppet var",
- "name": "storm_ui_keytab",
- "displayName": "Path to Nimbus UI keytab file",
- "value": "",
- "recommendedValue": "/etc/security/keytabs/spnego.service.keytab",
- "description": "Path to the Storm UI keytab file",
- "displayType": "directory",
- "isVisible": false,
- "isOverridable": false,
- "serviceName": "STORM",
- "filename": "storm-env.xml",
- "category": "Nimbus"
- }
-];
-
-if(App.get('isHadoop22Stack')) {
- props.configProperties.pushObjects(storm22Properties);
-} else {
- props.configProperties.pushObjects(stormProperties);
-}
-
-module.exports = props;
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/data/controller_route.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/controller_route.js b/ambari-web/app/data/controller_route.js
index d6319f5..d453c51 100644
--- a/ambari-web/app/data/controller_route.js
+++ b/ambari-web/app/data/controller_route.js
@@ -30,14 +30,6 @@ module.exports = [
route: 'main.hostAdd'
},
{
- wizardControllerName: App.router.get('addSecurityController.name'),
- route: 'main.admin.adminSecurity'
- },
- {
- wizardControllerName: App.router.get('mainAdminSecurityDisableController.name'),
- route: 'main.admin.adminSecurity'
- },
- {
wizardControllerName: App.router.get('kerberosWizardController.name'),
route: 'main.admin.adminKerberos.adminAddKerberos'
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6d579d5..955ef80 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1303,7 +1303,6 @@ Em.I18n.translations = {
'admin.security.enable.popup.header': 'Add security',
'admin.security.disable.popup.header': 'Remove security',
'admin.security.disable.popup.body': 'You are about to disable Kerberos on the cluster. This will stop all the services in your cluster and remove the Kerberos configurations. <strong>Are you sure you wish to proceed with disabling Kerberos?</strong>',
- 'admin.addSecurity.header': 'Enable Security Wizard',
'admin.security.step1.header': 'Get Started',
'admin.security.step2.header': 'Configure Services',
'admin.security.step3.header': 'Create Principals and Keytabs',
@@ -1331,32 +1330,7 @@ Em.I18n.translations = {
'admin.security.disable.body.header' : 'Disabling kerberos security on the cluster',
'admin.security.disable.body.success.header': 'Kerberos-based security has been disabled on your cluster. Please wait while services are started in non-secure mode.',
'admin.security.disable.body.failure.header': 'Failed to disable Kerberos-based security on your cluster. Your cluster will keep running in secure mode.',
- 'admin.addSecurity.apply.stop.services': 'Stop Services',
- 'admin.addSecurity.apply.save.config': 'Save Configurations',
- 'admin.addSecurity.apply.start.services': 'Start Services',
- 'admin.addSecurity.apply.delete.ats': 'Delete ATS',
- 'admin.addSecurity.user.smokeUser': 'Ambari Smoke Test User',
- 'admin.addSecurity.user.hdfsUser': 'HDFS User',
- 'admin.addSecurity.user.hbaseUser': 'HBase User',
- 'admin.addSecurity.user.stormUser': 'Storm User',
- 'admin.addSecurity.hdfs.user.httpUser': 'HDFS SPNEGO User',
- 'admin.addSecurity.rm.user.httpUser': 'ResourceManager SPNEGO User',
- 'admin.addSecurity.nm.user.httpUser': 'NodeManager SPNEGO User',
- 'admin.addSecurity.historyServer.user.httpUser': 'History server SPNEGO User',
- 'admin.addSecurity.webhcat.user.httpUser': 'WebHCat SPNEGO User',
- 'admin.addSecurity.hive.user.httpUser': 'Hive SPNEGO User',
- 'admin.addSecurity.oozie.user.httpUser': 'Oozie SPNEGO User',
- 'admin.addSecurity.falcon.user.httpUser': 'Falcon SPNEGO User',
- 'admin.addSecurity.storm.user.httpUser': 'Storm UI Server',
- 'admin.addSecurity.user.yarn.atsHTTPUser': 'YARN ATS HTTP User',
- 'admin.addSecurity.knox.user': 'Knox Gateway',
- 'admin.addSecurity.enable.onClose': 'You are in the process of enabling security on your cluster. ' +
- 'Are you sure you want to quit? If you quit, ' +
- 'you may have to re-run the security wizard from the beginning to enable security.',
- 'admin.addSecurity.enable.after.stage2.onClose': 'Services are being started with the Kerberos settings you specified. '+
- 'It is recommended that you wait until all the services are started to ensure that they are set up properly. ' +
- 'Are you sure you want to quit?',
- 'admin.addSecurity.disable.onClose': 'You are in the process of disabling security on your cluster. ' +
+ 'admin.security.disable.onClose': 'You are in the process of disabling security on your cluster. ' +
'Are you sure you want to quit?',
'admin.removeSecurity.header': 'Disable Security',
'admin.security.applying.config.header': 'Applying Configurations',
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/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 7e436ae..f8163e9 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -27,47 +27,6 @@ App.AddSecurityConfigs = Em.Mixin.create({
kerberosDescriptor: {},
- secureProperties: require('data/HDP2/secure_properties').configProperties,
-
- secureMapping: require('data/HDP2/secure_mapping'),
-
- serviceUsersBinding: 'App.router.mainAdminSecurityController.serviceUsers',
-
- componentsConfig: [
- {
- serviceName: 'OOZIE',
- componentName: 'OOZIE_SERVER',
- configName: 'oozieserver_host'
- },
- {
- serviceName: 'HIVE',
- componentName: 'WEBHCAT_SERVER',
- configName: 'webhcat_server'
- }
- ],
-
- /**
- * mock users used in testMode
- */
- testModeUsers: [
- {
- name: 'hdfs_user',
- value: 'hdfs'
- },
- {
- name: 'mapred_user',
- value: 'mapred'
- },
- {
- name: 'hbase_user',
- value: 'hbase'
- },
- {
- name: 'hive_user',
- value: 'hive'
- }
- ],
-
/**
* security configs, which values should be modified after APPLY CONFIGURATIONS stage
*/
@@ -95,289 +54,6 @@ App.AddSecurityConfigs = Em.Mixin.create({
return configs;
}.property('App.isHadoop22Stack'),
- secureServices: function () {
- return this.get('content.services');
- }.property('content.services'),
-
- /**
- * prepare secure configs
- */
- prepareSecureConfigs: function () {
- var configs = this.get('content.serviceConfigProperties');
- this.set('configs', configs);
- this.loadStaticConfigs(); //Hack for properties which are declared in site_properties.js and not able to retrieve values declared in secure_properties.js
- this.loadUsersToConfigs();
- this.loadHostNames();
- this.loadPrimaryNames();
- var uiConfigs = this.loadUiSideSecureConfigs();
- this.set('configs', this.get('configs').concat(uiConfigs));
- },
-
-
- /**
- * push users to configs
- */
- loadUsersToConfigs: function () {
- if (!this.get('serviceUsers').length) {
- this.loadUsersFromServer();
- }
- App.router.get('mainAdminSecurityController.serviceUsers').forEach(function (_user) {
- this.get('configs').pushObject(_user);
- }, this);
- },
-
- /**
- * add component config that contain host name as value
- * @param serviceName
- * @param componentName
- * @param configName
- * @return {Boolean}
- */
- addHostConfig: function (serviceName, componentName, configName) {
- var service = App.Service.find(serviceName);
- var isServiceSecure = this.get('secureServices').someProperty('serviceName', serviceName);
-
- if (service.get('isLoaded') && isServiceSecure) {
- var hostComponent = service.get('hostComponents').findProperty('componentName', componentName);
- if (hostComponent) {
- var hostName = hostComponent.get('hostName');
- this.get('configs').push({
- id: 'puppet var',
- name: configName,
- value: hostName
- });
- return true;
- }
- }
- return false;
- },
-
- /**
- * add hosts' names to configs
- */
- loadHostNames: function () {
- var componentsConfig = this.get('componentsConfig');
- componentsConfig.forEach(function (host) {
- this.addHostConfig(host.serviceName, host.componentName, host.configName);
- }, this);
- },
-
- /**
- * load static configs
- */
- loadStaticConfigs: function () {
- this.get('configs').forEach(function (_property) {
- switch (_property.name) {
- case 'security_enabled':
- _property.value = 'true';
- break;
- }
- }, this);
- },
-
- /**
- * add principals to properties
- */
- loadPrimaryNames: function () {
- var principalProperties = this.getPrincipalNames();
- principalProperties.forEach(function (_principalProperty) {
- var name = _principalProperty.name.replace('principal', 'primary');
- var value = _principalProperty.value.split('/')[0];
- this.get('configs').push({name: name, value: value});
- }, this);
- },
-
- /**
- * gather and return properties with "principal_name"
- * @return {Array}
- */
- getPrincipalNames: function () {
- var principalNames = [];
- this.get('configs').forEach(function (_property) {
- if (/principal_name?$/.test(_property.name)) {
- principalNames.push(_property);
- }
- }, this);
- this.get('secureProperties').forEach(function (_secureProperty) {
- if (/principal_name?$/.test(_secureProperty.name)) {
- var principalName = principalNames.findProperty('name', _secureProperty.name);
- if (!principalName) {
- _secureProperty.value = _secureProperty.defaultValue;
- principalNames.push(_secureProperty);
- }
- }
- }, this);
- return principalNames;
- },
-
- /**
- * load users from server
- */
- loadUsersFromServer: function () {
- if (App.get('testMode')) {
- var serviceUsers = this.get('serviceUsers');
- this.get('testModeUsers').forEach(function (user) {
- user.id = 'puppet var';
- serviceUsers.push(user);
- }, this);
- } else {
- App.router.set('mainAdminSecurityController.serviceUsers', App.db.getSecureUserInfo());
- }
- },
-
- /**
- * load configs from UI side
- * @return {Array}
- */
- loadUiSideSecureConfigs: function () {
- var uiConfig = [];
- var configs = this.get('secureMapping').filterProperty('foreignKey', null).filter(function (_configProperty) {
- return (App.Service.find().mapProperty('serviceName').contains(_configProperty.serviceName));
- }, this);
- configs.forEach(function (_config) {
- var value = _config.value;
- if (_config.hasOwnProperty('dependedServiceName')) {
- value = this.checkServiceForConfigValue(value, _config.dependedServiceName);
- }
- value = this.getConfigValue(_config.templateName, value, _config.name);
- uiConfig.push({
- "id": "site property",
- "name": _config.name,
- "value": value,
- "filename": _config.filename
- });
- }, this);
- var dependentConfig = this.get('secureMapping').filterProperty('foreignKey');
- dependentConfig.forEach(function (_config) {
- if (App.Service.find().mapProperty('serviceName').contains(_config.serviceName)) {
- this.setConfigValue(_config);
- this.formatConfigName(uiConfig, _config);
- uiConfig.push({
- "id": "site property",
- "name": _config._name || _config.name,
- "value": _config.value,
- "filename": _config.filename
- });
- }
- }, this);
- return uiConfig;
- },
-
- /**
- * erase template rules from config value if service is not loaded
- * @param value
- * @param services
- * @return {*}
- */
- checkServiceForConfigValue: function (value, services) {
- services.forEach(function (_service) {
- if (!App.Service.find(_service.name).get('isLoaded')) {
- value = value.replace(_service.replace, '');
- }
- }, this);
- return value;
- },
-
- /**
- * Set all site property that are derived from other puppet-variable
- * @param templateName
- * @param expression
- * @param name
- * @return {String|null}
- */
- getConfigValue: function (templateName, expression, name) {
- var express = expression.match(/<(.*?)>/g);
- var value = expression;
- if (Em.isNone(express)) return expression;
-
- express.forEach(function (_express) {
- var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
- var configs = this.get('configs').findProperty('name', templateName[index]);
- var configValue = templateName[index] == 'hive_metastore' ?
- configs.value.map(function (hostName) {
- return 'thrift://' + hostName + ':9083';
- }).join(',') : configs.value;
-
- if (!!value) {
- value = (configs) ? App.config.replaceConfigValues(name, _express, value, configValue) : null;
- }
- }, this);
- return value;
- },
-
- /**
- * format name of config values of configs which match foreignKey
- * @param uiConfig
- * @param config
- * @return {Boolean}
- */
- formatConfigName: function (uiConfig, config) {
- if (Em.isNone(config.value)) return false;
-
- var fkValue = config.name.match(/<(foreignKey.*?)>/g);
- if (fkValue) {
- fkValue.forEach(function (_fkValue) {
- var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
- var value;
- if (uiConfig.someProperty('name', config.foreignKey[index])) {
- value = uiConfig.findProperty('name', config.foreignKey[index]).value;
- config._name = config.name.replace(_fkValue, value);
- } else if (this.get('configs').someProperty('name', config.foreignKey[index])) {
- value = this.get('configs').findProperty('name', config.foreignKey[index]).value;
- config._name = config.name.replace(_fkValue, value);
- }
- }, this);
- return true;
- }
- return false;
- },
-
- /**
- * Set config value with values of configs which match template
- * @param config
- * @return {Boolean}
- */
- setConfigValue: function (config) {
- if (Em.isNone(config.value)) return false;
-
- //For properties in the configMapping file having foreignKey and templateName properties.
- var templateValue = config.value.match(/<(templateName.*?)>/g);
- if (templateValue) {
- templateValue.forEach(function (_value) {
- var index = parseInt(_value.match(/\[([\d]*)(?=\])/)[1]);
- var cfg = this.get('configs').findProperty('name', config.templateName[index]);
-
- if (cfg) {
- var cfgValue = config.templateName[index] == 'hive_metastore' ? cfg.value.join(',') : cfg.value;
- config.value = config.value.replace(_value, cfgValue);
- } else {
- config.value = null;
- }
- }, this);
- return true;
- }
- return false;
- },
-
- /**
- * set value of principal property
- * @param serviceName
- * @param principalName
- * @return {Boolean}
- */
- setPrincipalValue: function (serviceName, principalName) {
- var siteProperties = this.get('configs');
-
- var realmName = siteProperties.findProperty('name', 'kerberos_domain');
-
- if (this.get('secureServices').someProperty('serviceName', serviceName)) {
- var principalProperty = siteProperties.findProperty('name', principalName);
- principalProperty.value = principalProperty.value + '@' + realmName.value;
- return true;
- }
- return false;
- },
-
/**
* Generate stack descriptor configs.
*
[2/4] ambari git commit: AMBARI-11995 Remove add security wizard from
Ambari. (ababiichuk)
Posted by ab...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/routes/add_security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/add_security.js b/ambari-web/app/routes/add_security.js
deleted file mode 100644
index dce4bed..0000000
--- a/ambari-web/app/routes/add_security.js
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * 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 = App.WizardRoute.extend({
- route: '/addSecurity',
- enter: function (router) {
- console.log('in /security/add:enter');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(Ember.run.next(function () {
- //after refresh check if the wizard is open then restore it
- if (router.get('mainAdminSecurityController').getAddSecurityWizardStatus() === 'RUNNING') {
- var mainAdminSecurityController = router.get('mainAdminSecurityController');
- var addSecurityController = router.get('addSecurityController');
- var currentStep = router.get('addSecurityController').get('currentStep');
- App.router.get('updateController').set('isWorking', false);
- App.ModalPopup.show({
- classNames: ['full-width-modal'],
- header: Em.I18n.t('admin.addSecurity.header'),
- bodyClass: App.MainAdminSecurityAddMenuView.extend({
- controllerBinding: 'App.router.addSecurityController'
- }),
- primary: Em.I18n.t('form.cancel'),
- secondary: null,
- showFooter: false,
-
- onClose: function () {
- var self = this;
- if (router.get('addSecurityController.currentStep') == 4) {
- var controller = router.get('mainAdminSecurityAddStep4Controller');
- if (!controller.get('isSubmitDisabled')) {
- router.get('mainAdminSecurityAddStep4Controller').clearStep();
- self.proceedOnClose();
- return;
- }
- var applyingConfigCommand = router.get('mainAdminSecurityAddStep4Controller.commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- if (applyingConfigCommand) {
- if (!applyingConfigCommand.get('isCompleted')) {
- if (applyingConfigCommand.get('isStarted')) {
- App.showAlertPopup(Em.I18n.t('admin.security.applying.config.header'), Em.I18n.t('admin.security.applying.config.body'));
- } else {
- App.showConfirmationPopup(function () {
- self.proceedOnClose();
- }, Em.I18n.t('admin.addSecurity.enable.onClose'));
- }
- } else {
- App.showConfirmationPopup(function () {
- self.proceedOnClose();
- },
- Em.I18n.t('admin.addSecurity.enable.after.stage2.onClose')
- );
- }
- return;
- }
- }
- router.get('mainAdminSecurityAddStep4Controller').clearStep();
- App.db.setSecurityDeployCommands(undefined);
- self.proceedOnClose();
- },
- proceedOnClose: function () {
- var self = this;
- router.get('mainAdminSecurityAddStep4Controller').clearStep();
- router.get('addSecurityController.content.services').clear();
- router.set('addSecurityController.content.serviceConfigProperties', null);
- App.router.get('updateController').set('isWorking', true);
- mainAdminSecurityController.setAddSecurityWizardStatus(null);
- App.db.setSecurityDeployCommands(undefined);
- addSecurityController.finish();
- App.clusterStatus.setClusterStatus({
- clusterName: router.get('content.cluster.name'),
- clusterState: 'DEFAULT',
- localdb: App.db.data
- }, {alwaysCallback: function() {
- self.hide();
- router.transitionTo('adminSecurity.index');
- location.reload(); // this is needed because the ATS Component may be deleted in older HDP stacks.
- }});
- },
- didInsertElement: function () {
- this.fitHeight();
- }
- }
- );
-
- App.router.transitionTo('step' + currentStep);
- } else {
- router.transitionTo('adminSecurity.index');
- }
- }));
- },
-
- step1: Em.Route.extend({
- route: '/start',
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('1');
- if(!App.get('testMode')){
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('clusterName'),
- clusterState: 'ADD_SECURITY_STEP_1',
- wizardControllerName: router.get('addSecurityController.name'),
- localdb: App.db.data
- });
- }
- },
-
- connectOutlets: function (router) {
- console.log('in addSecurity.step1:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.connectOutlet('mainAdminSecurityAddStep1', controller.get('content'));
- })
- },
-
- unroutePath: function () {
- return false;
- },
-
- next: function (router) {
- var addSecurityController = router.get('addSecurityController');
- addSecurityController.get('content').set('serviceConfigProperties', null);
- App.db.setSecureConfigProperties(null);
- router.transitionTo('step2');
- }
- }),
-
- step2: Em.Route.extend({
- route: '/configure',
-
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('2');
- if(!App.get('testMode')){
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('clusterName'),
- clusterState: 'ADD_SECURITY_STEP_2',
- wizardControllerName: router.get('addSecurityController.name'),
- localdb: App.db.data
- });
- }
- },
- connectOutlets: function (router) {
- console.log('in addSecurity.step2:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.connectOutlet('mainAdminSecurityAddStep2', controller.get('content'));
- })
- },
- unroutePath: function () {
- return false;
- },
- back: Em.Router.transitionTo('step1'),
- next: function (router) {
- var addSecurityController = router.get('addSecurityController');
- var addSecurityStep2Controller = router.get('mainAdminSecurityAddStep2Controller');
- addSecurityController.saveServiceConfigProperties(addSecurityStep2Controller);
- router.transitionTo('step3');
- }
- }),
-
- step3: Em.Route.extend({
- route: '/principal_keytab',
-
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('3');
- if(!App.get('testMode')){
- App.clusterStatus.setClusterStatus({
- clusterName: this.get('clusterName'),
- clusterState: 'ADD_SECURITY_STEP_3',
- wizardControllerName: router.get('addSecurityController.name'),
- localdb: App.db.data
- });
- }
- },
- connectOutlets: function (router) {
- console.log('in addSecurity.step3:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.connectOutlet('mainAdminSecurityAddStep3', controller.get('content'));
- })
- },
- unroutePath: function () {
- return false;
- },
- back: Em.Router.transitionTo('step2'),
- next: function (router) {
- App.db.setSecurityDeployCommands(undefined);
- router.transitionTo('step4');
- }
- }),
-
- step4: Em.Route.extend({
- route: '/apply',
-
- enter: function (router) {
- router.get('addSecurityController').setCurrentStep('4');
- },
-
- connectOutlets: function (router) {
- console.log('in addSecurity.step4:connectOutlets');
- var controller = router.get('addSecurityController');
- controller.dataLoading().done(function () {
- controller.loadAllPriorSteps();
- controller.setLowerStepsDisable(4);
- controller.connectOutlet('mainAdminSecurityAddStep4', controller.get('content'));
- })
- },
- unroutePath: function () {
- return false;
- },
- back: function (router, context) {
- var controller = router.get('mainAdminSecurityAddStep4Controller');
- if (!controller.get('isBackBtnDisabled')) {
- router.transitionTo('step3');
- }
- },
- done: function (router, context) {
- var controller = router.get('mainAdminSecurityAddStep4Controller');
- if (!controller.get('isSubmitDisabled')) {
- $(context.currentTarget).parents("#modal").find(".close").trigger('click');
- }
- }
- })
-
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 78d8243..c410d15 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -356,43 +356,6 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
}
}),
- adminSecurity: Em.Route.extend({
- route: '/security',
- enter: function (router) {
- router.set('mainAdminController.category', "security");
- var controller = router.get('mainAdminSecurityController');
- if (!(controller.getAddSecurityWizardStatus() === 'RUNNING') && !(controller.getDisableSecurityStatus() === 'RUNNING')) {
- Em.run.next(function () {
- router.transitionTo('adminSecurity.index');
- });
- } else if (controller.getAddSecurityWizardStatus() === 'RUNNING') {
- Em.run.next(function () {
- router.transitionTo('adminAddSecurity');
- });
- } else if (controller.getDisableSecurityStatus() === 'RUNNING') {
- Em.run.next(function () {
- router.transitionTo('disableSecurity');
- });
- }
- },
-
- index: Em.Route.extend({
- route: '/',
- connectOutlets: function (router, context) {
- var controller = router.get('mainAdminController');
- controller.set('category', "security");
- controller.connectOutlet('mainAdminSecurity');
- }
- }),
-
- addSecurity: function (router, object) {
- router.get('mainAdminSecurityController').setAddSecurityWizardStatus('RUNNING');
- router.transitionTo('adminAddSecurity');
- },
-
- adminAddSecurity: require('routes/add_security')
- }),
-
adminKerberos: Em.Route.extend({
route: '/kerberos',
index: Em.Route.extend({
@@ -436,7 +399,7 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
// otherwise show confirmation window
App.showConfirmationPopup(function () {
self.proceedOnClose();
- }, Em.I18n.t('admin.addSecurity.disable.onClose'));
+ }, Em.I18n.t('admin.security.disable.onClose'));
}
} else {
self.proceedOnClose();
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs b/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs
new file mode 100644
index 0000000..a68102a
--- /dev/null
+++ b/ambari-web/app/templates/main/admin/kerberos/notify_security_off_popup.hbs
@@ -0,0 +1,21 @@
+{{!
+* 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.
+}}
+
+<div class="alert">
+ {{t admin.security.disable.popup.body}}
+</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security.hbs b/ambari-web/app/templates/main/admin/security.hbs
deleted file mode 100644
index 2355937..0000000
--- a/ambari-web/app/templates/main/admin/security.hbs
+++ /dev/null
@@ -1,43 +0,0 @@
-{{!
-* 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.
-}}
-{{#if dataIsLoaded}}
- {{#if securityEnabled}}
- <div>
- <p class="text-success">{{t admin.security.enabled}}
- {{#isAccessible ADMIN}}
- <a class="btn btn-padding btn-warning admin-disable-security-btn" {{bindAttr disabled="isSubmitDisabled"}} {{action notifySecurityOffPopup target="controller"}}>{{t admin.security.button.disable}}
- </a> <br/>
- {{/isAccessible}}
- </p>
- </div>
- <div id="serviceConfig">
- {{view App.ServicesConfigView}}
- </div>
- {{else}}
- <div>
- <p class="muted">{{t admin.security.disabled}}
- {{#isAccessible ADMIN}}
- <a class="btn btn-padding btn-success admin-enable-security-btn" {{action addSecurity}}>{{t admin.security.button.enable}}
- </a> <br/>
- {{/isAccessible}}
- </p>
- </div>
- {{/if}}
-{{else}}
- <div class="spinner"></div>
-{{/if}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/menu.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/menu.hbs b/ambari-web/app/templates/main/admin/security/add/menu.hbs
deleted file mode 100644
index fe52c8d..0000000
--- a/ambari-web/app/templates/main/admin/security/add/menu.hbs
+++ /dev/null
@@ -1,42 +0,0 @@
-{{!
-* 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.
-}}
-
-
-<div class="wizard" id="enable_security">
- <div class="container">
- <div class="container-fluid">
- <div class="row-fluid">
- <div class="span3">
- <!--Sidebar content-->
- <div class="well">
- <ul class="nav nav-pills nav-stacked">
- <li class="nav-header">{{t admin.addSecurity.header}}</li>
- <li {{bindAttr class="isStep1:active view.isStep1Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep1 target="controller"}}>{{t admin.security.step1.header}}</a></li>
- <li {{bindAttr class="isStep2:active view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep2 target="controller"}}>{{t admin.security.step2.header}}</a></li>
- <li {{bindAttr class="isStep3:active view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep3 target="controller"}}>{{t admin.security.step3.header}}</a></li>
- <li {{bindAttr class="isStep4:active view.isStep4Disabled:disabled"}}><a href="javascript:void(null);" {{action gotoStep4 target="controller"}}>{{t admin.security.step4.header}}</a></li>
- </ul>
- </div>
- </div>
- <div class="wizard-content well span9">
- {{outlet}}
- </div>
- </div>
- </div>
- </div>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step1.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step1.hbs b/ambari-web/app/templates/main/admin/security/add/step1.hbs
deleted file mode 100644
index a8684c8..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step1.hbs
+++ /dev/null
@@ -1,38 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step1.header}}</h2>
-<p class="alert">
- {{t admin.security.step1.body.header}}
-</p>
-<div class="alert alert-info">
- <ol>
- <li>{{t admin.security.step1.body.instruction1}}</li>
- <li>{{t admin.security.step1.body.instruction2}}</li>
- <li>{{t admin.security.step1.body.instruction3}}</li>
- <li>{{t admin.security.step1.body.instruction4}}</li>
- {{#if view.shouldRemoveATS}}
- <li>{{{t admin.security.step1.body.instruction5}}}</li>
- {{/if}}
- </ol>
-</div>
-
-
-<div class="btn-area">
- <a class="btn btn-success pull-right" {{action "next"}}>{{t common.next}} →</a>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step2.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step2.hbs b/ambari-web/app/templates/main/admin/security/add/step2.hbs
deleted file mode 100644
index c900fcd..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step2.hbs
+++ /dev/null
@@ -1,34 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step2.header}}</h2>
-
-<div id="serviceConfig">
- <p class="alert alert-info">
- {{t admin.security.step2.body.header}}
- </p>
- {{view App.ServicesConfigView}}
-
- <div class="btn-area">
- <a class="btn" {{action back}}>← {{t common.back}}</a>
-
- <button class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
- {{action next}}>{{t common.next}} →
- </button>
- </div>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step3.hbs b/ambari-web/app/templates/main/admin/security/add/step3.hbs
deleted file mode 100644
index b57c6fd..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step3.hbs
+++ /dev/null
@@ -1,31 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step3.header}}</h2>
-<div class="alert alert-info">{{t admin.security.step3.notice}}</div>
-{{#if isLoaded}}
- <div class="btn-area">
- <a class="btn" {{action back}}>← {{t common.back}}</a>
- <div class="pull-right">
- <button class="btn btn-info" {{action doDownloadCsv target="controller"}}>{{t admin.security.step3.downloadCSV}}</button>
- <button class="btn btn-success" {{bindAttr disabled="isSubmitDisabled"}} {{action next}}>{{t common.apply}} →</button>
- </div>
- </div>
-{{else}}
- <div class="spinner"></div>
-{{/if}}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/add/step4.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/add/step4.hbs b/ambari-web/app/templates/main/admin/security/add/step4.hbs
deleted file mode 100644
index 7736c0b..0000000
--- a/ambari-web/app/templates/main/admin/security/add/step4.hbs
+++ /dev/null
@@ -1,32 +0,0 @@
-{{!
-* 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.
-}}
-
-<h2>{{t admin.security.step4.header}}</h2>
-
-{{#if view.message}}
- <p {{bindAttr class="view.msgColor :alert"}}>{{view.message}}</p>
-{{/if}}
-
-{{view App.MainServiceReconfigureView}}
-
-<div class="btn-area">
- <a class="btn" {{bindAttr disabled="isBackBtnDisabled"}}
- {{action back}}>← {{t common.back}}</a>
- <a class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
- {{action done}}>{{t common.done}} </a>
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/disable.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/disable.hbs b/ambari-web/app/templates/main/admin/security/disable.hbs
deleted file mode 100644
index 3f2fb21..0000000
--- a/ambari-web/app/templates/main/admin/security/disable.hbs
+++ /dev/null
@@ -1,26 +0,0 @@
-{{!
-* 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.
-}}
-
-{{#if view.message}}
- <p {{bindAttr class="view.msgColor :alert"}}>{{view.message}}</p>
-{{/if}}
-{{view App.MainServiceReconfigureView}}
-<div class="btn-area">
- <button class="btn btn-success pull-right" {{bindAttr disabled="isSubmitDisabled"}}
- {{action done}}>{{t common.done}} </button>
-</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs b/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs
deleted file mode 100644
index a68102a..0000000
--- a/ambari-web/app/templates/main/admin/security/notify_security_off_popup.hbs
+++ /dev/null
@@ -1,21 +0,0 @@
-{{!
-* 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.
-}}
-
-<div class="alert">
- {{t admin.security.disable.popup.body}}
-</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index 6c75340..97ac87c 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -922,10 +922,6 @@ App.HostPopup = Em.Object.create({
*/
switchLevel: function (levelName) {
var dataSourceController = this.get('controller.dataSourceController');
- var securityControllers = [
- 'mainAdminSecurityDisableController',
- 'mainAdminSecurityAddStep4Controller'
- ];
if (this.get("controller.isBackgroundOperations")) {
var levelInfo = dataSourceController.get('levelInfo');
levelInfo.set('taskId', this.get('openedTaskId'));
@@ -944,13 +940,6 @@ App.HostPopup = Em.Object.create({
} else {
this.set('taskCategory', this.get('categories').findProperty('value','all'));
}
- } else if (securityControllers.contains(dataSourceController.get('name'))) {
- if (levelName === 'TASK_DETAILS') {
- this.set('isLevelLoaded', false);
- dataSourceController.startUpdatingTask(this.get('controller.currentServiceId'), this.get('openedTaskId'));
- } else {
- dataSourceController.stopUpdatingTask(this.get('controller.currentServiceId'));
- }
} else if (dataSourceController.get('name') == 'highAvailabilityProgressPopupController') {
if (levelName === 'TASK_DETAILS') {
this.set('isLevelLoaded', false);
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index d796441..f766d84 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -177,14 +177,6 @@ require('views/main/admin/kerberos/step6_view');
require('views/main/admin/kerberos/step7_view');
require('views/main/admin/kerberos/step8_view');
-require('views/main/admin/security');
-require('views/main/admin/security/disable');
-require('views/main/admin/security/add/menu');
-require('views/main/admin/security/add/step1');
-require('views/main/admin/security/add/step2');
-require('views/main/admin/security/add/step3');
-require('views/main/admin/security/add/step4');
-
require('views/main/dashboard');
require('views/main/dashboard/cluster_metrics/cpu');
require('views/main/dashboard/cluster_metrics/load');
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/common/configs/service_configs_by_category_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/service_configs_by_category_view.js b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
index 47722e1..41e59fd 100644
--- a/ambari-web/app/views/common/configs/service_configs_by_category_view.js
+++ b/ambari-web/app/views/common/configs/service_configs_by_category_view.js
@@ -147,7 +147,7 @@ App.ServiceConfigsByCategoryView = Em.View.extend(App.UserPref, App.ConfigOverri
console.log("Unable to load modification handler for ", serviceId);
}
if (serviceConfigModificationHandler != null) {
- var securityEnabled = App.router.get('mainAdminSecurityController.securityEnabled');
+ var securityEnabled = App.router.get('mainAdminKerberosController.securityEnabled');
this.affectedProperties = serviceConfigModificationHandler.getDependentConfigChanges(changedProperty, this.get("controller.selectedServiceNames"), stepConfigs, securityEnabled);
}
changedProperty.set("editDone", false); // Turn off flag
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security.js b/ambari-web/app/views/main/admin/security.js
deleted file mode 100644
index 4dcd0af..0000000
--- a/ambari-web/app/views/main/admin/security.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityView = Em.View.extend({
- templateName: require('templates/main/admin/security'),
- didInsertElement: function() {
- this.set('controller.dataIsLoaded',false);
- this.get('controller').setSecurityStatus();
- },
-
- configProperties: function () {
- var configProperties = [];
- var stepConfigs = this.get('controller.stepConfigs');
- if (stepConfigs) {
- this.get('controller.stepConfigs').mapProperty('configs').forEach(function (_stepProperties) {
- _stepProperties.forEach(function (_stepConfigProperty) {
- configProperties.pushObject(_stepConfigProperty);
- }, this);
- }, this);
- }
- return configProperties;
- }.property('controller.stepConfigs.@each.configs'),
-
- realmName: function () {
- return this.get('configProperties').findProperty('name', 'kerberos_domain');
- }.property('configProperties'),
-
- onRealmNameChange: function () {
- this.get('configProperties').forEach(function (_property) {
- if (/principal_name?$/.test(_property.get('name'))) {
- _property.set('unit', '@' + this.get('realmName.value'));
- }
- }, this);
- }.observes('realmName.value')
-
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/menu.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/menu.js b/ambari-web/app/views/main/admin/security/add/menu.js
deleted file mode 100644
index 628c6ed..0000000
--- a/ambari-web/app/views/main/admin/security/add/menu.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddMenuView = Em.View.extend(App.WizardMenuMixin, {
-
- templateName: require('templates/main/admin/security/add/menu')
-
-});
-
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step1.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step1.js b/ambari-web/app/views/main/admin/security/add/step1.js
deleted file mode 100644
index 6ef6996..0000000
--- a/ambari-web/app/views/main/admin/security/add/step1.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep1View = Em.View.extend({
-
- templateName: require('templates/main/admin/security/add/step1'),
- shouldRemoveATS: false,
- didInsertElement: function(){
- var shouldRemoveATS = this.get('controller').shouldRemoveATS();
- this.set('shouldRemoveATS', shouldRemoveATS);
- }
-
-});
-
-
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step2.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step2.js b/ambari-web/app/views/main/admin/security/add/step2.js
deleted file mode 100644
index c97203f..0000000
--- a/ambari-web/app/views/main/admin/security/add/step2.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep2View = Em.View.extend({
-
- templateName: require('templates/main/admin/security/add/step2'),
-
- configProperties: function () {
- var configProperties = [];
- var stepConfigs = this.get('controller.stepConfigs');
- if (stepConfigs) {
- this.get('controller.stepConfigs').mapProperty('configs').forEach(function (_stepProperties) {
- _stepProperties.forEach(function (_stepConfigProperty) {
- configProperties.pushObject(_stepConfigProperty);
- }, this);
- }, this);
- }
- return configProperties;
- }.property('controller.stepConfigs.@each.configs'),
-
- realmName: function () {
- return this.get('configProperties').findProperty('name', 'kerberos_domain');
- }.property('configProperties'),
-
- onRealmNameChange: function () {
- this.get('configProperties').forEach(function (_property) {
- if (/principal_name?$/.test(_property.get('name')) || _property.get('name') == 'namenode_principal_name_falcon') {
- _property.set('unit', '@' + this.get('realmName.value'));
- }
- }, this);
- }.observes('realmName.value')
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step3.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step3.js b/ambari-web/app/views/main/admin/security/add/step3.js
deleted file mode 100644
index b7ad4fc..0000000
--- a/ambari-web/app/views/main/admin/security/add/step3.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep3View = Em.View.extend({
- templateName: require('templates/main/admin/security/add/step3'),
- didInsertElement: function() {
- this.set('controller.isLoaded', false);
- this.get('controller').loadHosts();
- }
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/add/step4.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/add/step4.js b/ambari-web/app/views/main/admin/security/add/step4.js
deleted file mode 100644
index 597814f..0000000
--- a/ambari-web/app/views/main/admin/security/add/step4.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityAddStep4View = Em.View.extend({
-
- templateName: require('templates/main/admin/security/add/step4'),
- didInsertElement: function () {
- this.get('controller').loadStep();
- },
- msgColor: 'alert-info',
- message: Em.I18n.t('admin.security.step4.body.header'),
- onResult: function () {
- var stopServiceCommand = this.get('controller.commands').findProperty('name', 'STOP_SERVICES');
- var applyConfigCommand = this.get('controller.commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- if (applyConfigCommand && applyConfigCommand.get('isSuccess') === true ) {
- this.set('message', Em.I18n.t('admin.security.step4.body.success.header'));
- this.set('msgColor','alert-success');
- } else if ((stopServiceCommand && stopServiceCommand.get('isError') === true) || (applyConfigCommand && applyConfigCommand.get('isError') === true)) {
- this.set('message', Em.I18n.t('admin.security.step4.body.failure.header'));
- this.set('msgColor','alert-error');
- } else {
- this.set('message', Em.I18n.t('admin.security.step4.body.header'));
- this.set('msgColor','alert-info');
- }
- }.observes('controller.commands.@each.isCompleted')
-
-});
-
-App.StageStatusView = Em.View.extend({
- tagName: 'tr',
- hasStarted: null,
- classNameBindings: ['faintText']
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/app/views/main/admin/security/disable.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/security/disable.js b/ambari-web/app/views/main/admin/security/disable.js
deleted file mode 100644
index 5d578a1..0000000
--- a/ambari-web/app/views/main/admin/security/disable.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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');
-
-App.MainAdminSecurityDisableView = Em.View.extend({
-
- templateName: require('templates/main/admin/security/disable'),
-
- didInsertElement: function () {
- this.get('controller').loadStep();
- },
- msgColor: 'alert-info',
- message: Em.I18n.t('admin.security.disable.body.header'),
- onResult: function () {
- var stopServiceCommand = this.get('controller.commands').findProperty('name', 'STOP_SERVICES');
- var applyConfigCommand = this.get('controller.commands').findProperty('name', 'APPLY_CONFIGURATIONS');
- if (applyConfigCommand && applyConfigCommand.get('isSuccess') === true ) {
- this.set('message', Em.I18n.t('admin.security.disable.body.success.header'));
- this.set('msgColor', 'alert-success');
- } else if ((stopServiceCommand && stopServiceCommand.get('isError') === true) || (applyConfigCommand && applyConfigCommand.get('isError') === true)) {
- this.set('message', Em.I18n.t('admin.security.disable.body.failure.header'));
- this.set('msgColor', 'alert-error');
- } else {
- this.set('message', Em.I18n.t('admin.security.disable.body.header'));
- this.set('msgColor', 'alert-info');
- }
- }.observes('controller.commands.@each.isCompleted')
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js b/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js
deleted file mode 100644
index c48760d..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/addSecurity_controller_test.js
+++ /dev/null
@@ -1,256 +0,0 @@
-/**
- * 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');
-require('mixins/common/localStorage');
-require('controllers/wizard');
-require('controllers/main/admin/security/add/addSecurity_controller');
-require('models/cluster');
-require('models/service');
-
-describe('App.AddSecurityController', function () {
-
- var controller = App.AddSecurityController.create({
- currentStep: null,
- content: Em.Object.create({
- isATSInstalled: true,
- services: [],
- isNnHa: 'false',
- serviceConfigProperties: null
- })
- });
-
- describe('#installedServices', function () {
-
- afterEach(function () {
- App.Service.find.restore();
- });
-
- it('No installed services', function () {
- sinon.stub(App.Service, 'find', function () {
- return [];
- });
- expect(controller.get('installedServices')).to.eql([]);
- });
- it('One service installed', function () {
- sinon.stub(App.Service, 'find', function () {
- return [Em.Object.create({serviceName: 'HDFS'})];
- });
- Em.propertyDidChange(controller, 'installedServices');
- expect(controller.get('installedServices')).to.eql(['HDFS']);
- });
- });
-
- describe('#loadAllPriorSteps()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'loadServiceConfigs', Em.K);
- sinon.stub(controller, 'loadServices', Em.K);
- sinon.stub(controller, 'loadNnHaStatus', Em.K);
- });
- afterEach(function () {
- controller.loadServiceConfigs.restore();
- controller.loadServices.restore();
- controller.loadNnHaStatus.restore();
- });
-
- var commonSteps = ['4', '3', '2'];
- commonSteps.forEach(function (step) {
- it('Current step - ' + step, function () {
- controller.set('currentStep', step);
- controller.loadAllPriorSteps();
- expect(controller.loadServiceConfigs.calledOnce).to.be.true;
- expect(controller.loadServices.calledOnce).to.be.true;
- expect(controller.loadNnHaStatus.calledOnce).to.be.true;
- });
- });
- it('Current step - 1', function () {
- controller.set('currentStep', '1');
- controller.loadAllPriorSteps();
- expect(controller.loadServiceConfigs.called).to.be.false;
- expect(controller.loadServices.calledOnce).to.be.true;
- expect(controller.loadNnHaStatus.calledOnce).to.be.true;
- });
- });
-
- describe('#loadServices()', function () {
- it('No installed services', function () {
- controller.reopen({
- installedServices: [],
- secureServices: [
- {serviceName: 'GENERAL'}
- ]
- });
- controller.loadServices();
- expect(controller.get('content.services').mapProperty('serviceName')).to.eql(['GENERAL']);
- });
- it('Installed service does not match the secure one', function () {
- controller.set('installedServices', ["HDFS"]);
- controller.loadServices();
- expect(controller.get('content.services').mapProperty('serviceName')).to.eql(['GENERAL']);
- });
- it('Installed service matches the secure one', function () {
- controller.set('secureServices', [
- {serviceName: 'GENERAL'},
- {serviceName: 'HDFS'}
- ]);
- controller.loadServices();
- expect(controller.get('content.services').mapProperty('serviceName')).to.eql(['GENERAL', 'HDFS']);
- });
- });
-
- describe('#loadNnHaStatus()', function () {
- afterEach(function () {
- App.db.getIsNameNodeHa.restore();
- });
- it('NameNode HA is off', function () {
- sinon.stub(App.db, 'getIsNameNodeHa', function () {
- return false;
- });
- controller.loadNnHaStatus();
- expect(controller.get('content.isNnHa')).to.be.false;
- });
- it('NameNode HA is on', function () {
- sinon.stub(App.db, 'getIsNameNodeHa', function () {
- return true;
- });
- controller.loadNnHaStatus();
- expect(controller.get('content.isNnHa')).to.be.true;
- });
- });
-
- describe('#loadServiceConfigs()', function () {
- afterEach(function () {
- App.db.getSecureConfigProperties.restore();
- });
- it('SecureConfigProperties is empty', function () {
- sinon.stub(App.db, 'getSecureConfigProperties', function () {
- return [];
- });
- controller.loadServiceConfigs();
- expect(controller.get('content.serviceConfigProperties')).to.eql([]);
- });
- it('SecureConfigProperties has one config', function () {
- sinon.stub(App.db, 'getSecureConfigProperties', function () {
- return [{}];
- });
- controller.loadServiceConfigs();
- expect(controller.get('content.serviceConfigProperties')).to.eql([{}]);
- });
- });
-
- describe('#getConfigOverrides()', function () {
- var testCases = [
- {
- title: 'overrides is null',
- configProperty: Em.Object.create({overrides: null}),
- result: null
- },
- {
- title: 'overrides is empty',
- configProperty: Em.Object.create({overrides: []}),
- result: null
- },
- {
- title: 'overrides has one override',
- configProperty: Em.Object.create({
- overrides: [
- Em.Object.create({
- value: 'value1',
- selectedHostOptions: []
- })
- ]
- }),
- result: [{
- value: 'value1',
- hosts: []
- }]
- },
- {
- title: 'overrides has one override with hosts',
- configProperty: Em.Object.create({
- overrides: [
- Em.Object.create({
- value: 'value1',
- selectedHostOptions: ['host1']
- })
- ]
- }),
- result: [{
- value: 'value1',
- hosts: ['host1']
- }]
- }
- ];
-
- testCases.forEach(function(test){
- it(test.title, function () {
- expect(controller.getConfigOverrides(test.configProperty)).to.eql(test.result);
- });
- });
- });
-
- describe('#saveServiceConfigProperties()', function () {
- var testCases = [
- {
- title: 'stepConfigs is empty',
- stepController: Em.Object.create({
- stepConfigs: []
- }),
- result: []
- },
- {
- title: 'No configs in service',
- stepController: Em.Object.create({
- stepConfigs: [
- Em.Object.create({configs: []})
- ]
- }),
- result: []
- }
- ];
-
- testCases.forEach(function (test) {
- it(test.title, function () {
- sinon.stub(App.db, 'setSecureConfigProperties', Em.K);
- controller.saveServiceConfigProperties(test.stepController);
- expect(App.db.setSecureConfigProperties.calledWith(test.result)).to.be.true;
- expect(controller.get('content.serviceConfigProperties')).to.eql(test.result);
- App.db.setSecureConfigProperties.restore();
- });
- });
- it('Service has config', function () {
- var stepController = Em.Object.create({
- stepConfigs: [
- Em.Object.create({configs: [
- Em.Object.create({
- name: 'config1',
- value: 'value1'
- })
- ]})
- ]
- });
- sinon.stub(App.db, 'setSecureConfigProperties', Em.K);
- controller.saveServiceConfigProperties(stepController);
- expect(App.db.setSecureConfigProperties.calledOnce).to.be.true;
- expect(controller.get('content.serviceConfigProperties').mapProperty('name')).to.eql(['config1']);
- App.db.setSecureConfigProperties.restore();
- });
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/ambari-web/test/controllers/main/admin/security/add/step1_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/step1_test.js b/ambari-web/test/controllers/main/admin/security/add/step1_test.js
deleted file mode 100644
index 5f836ae..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/step1_test.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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');
-
-require('controllers/main/admin/security/add/step1');
-require('models/service');
-var controller;
-describe('App.MainAdminSecurityAddStep1Controller', function () {
-
- beforeEach(function () {
- controller = App.MainAdminSecurityAddStep1Controller.create({
- content: {}
- });
- });
-
- describe('#shouldRemoveATS()', function () {
-
- var tests = Em.A([
- {
- doesATSSupportKerberos: true,
- isATSInstalled: true,
- e: false
- },
- {
- doesATSSupportKerberos: true,
- isATSInstalled: false,
- e: false
- },
- {
- doesATSSupportKerberos: false,
- isATSInstalled: true,
- e: true
- },
- {
- doesATSSupportKerberos: false,
- isATSInstalled: false,
- e: false
- }
- ]);
-
- tests.forEach(function (test) {
- it('', function () {
- controller.set('content.isATSInstalled', test.isATSInstalled);
- sinon.stub(App, 'get', function (k) {
- if ('doesATSSupportKerberos' === k) return test.doesATSSupportKerberos;
- return Em.get(App, k);
- });
- var result = controller.shouldRemoveATS();
- App.get.restore();
- expect(result).to.equal(test.e);
- });
- });
-
- });
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/c61933d8/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
deleted file mode 100644
index d932392..0000000
--- a/ambari-web/test/controllers/main/admin/security/add/step2_test.js
+++ /dev/null
@@ -1,718 +0,0 @@
-/**
- * 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');
-
-require('controllers/main/admin/security/add/step2');
-require('models/service');
-
-describe('App.MainAdminSecurityAddStep2Controller', function () {
-
- var controller = App.MainAdminSecurityAddStep2Controller.create({
- content: {}
- });
-
- describe('#clearStep()', function () {
- it('Info is empty', function () {
- controller.set('stepConfigs', []);
- controller.set('securityUsers', []);
- controller.clearStep();
- expect(controller.get('stepConfigs')).to.be.empty;
- expect(controller.get('securityUsers')).to.be.empty;
- });
- it('Info filled', function () {
- controller.set('stepConfigs', [1]);
- controller.set('securityUsers', [1]);
- controller.clearStep();
- expect(controller.get('stepConfigs')).to.be.empty;
- expect(controller.get('securityUsers')).to.be.empty;
- });
- });
-
- describe('#isSubmitDisabled', function () {
- var tests = [
- {
- config: [
- {
- showConfig: true,
- errorCount: 0
- }
- ],
- m: 'All show configs, nothing with errors',
- e: false
- },
- {
- config: [
- {
- showConfig: true,
- errorCount: 0
- },
- {
- showConfig: true,
- errorCount: 1
- }
- ],
- m: 'All show configs, 1 with errors',
- e: true
- },
- {
- config: [
- {
- showConfig: true,
- errorCount: 0
- },
- {
- showConfig: false,
- errorCount: 1
- }
- ],
- m: '1 has errors but not visible',
- e: false
- },
- {
- config: [
- {
- showConfig: false,
- errorCount: 0
- },
- {
- showConfig: false,
- errorCount: 1
- }
- ],
- m: '1 has errors, all not visible',
- e: false
- },
- {
- config: [
- {
- showConfig: true,
- errorCount: 1
- },
- {
- showConfig: true,
- errorCount: 1
- }
- ],
- m: 'All has errors, all not visible',
- e: true
- }
- ];
- tests.forEach(function (test) {
- it(test.m, function () {
- controller.set('stepConfigs', test.config);
- expect(controller.get('isSubmitDisabled')).to.equal(test.e);
- });
- });
- });
-
- describe('#loadStep()', function () {
- it('load step', function () {
- controller.set('stepConfigs', [
- {}
- ]);
- controller.set('securityUsers', ['user1']);
- controller.set('content.services', ['service1']);
- controller.set('content.serviceConfigProperties', ['config1']);
- sinon.stub(controller, 'clearStep', Em.K);
- sinon.stub(controller, 'loadUsers', Em.K);
- sinon.stub(controller, 'addUserPrincipals', Em.K);
- sinon.stub(controller, 'renderServiceConfigs', Em.K);
- sinon.stub(controller, 'changeCategoryOnHa', Em.K);
- sinon.stub(controller, 'setStoredConfigsValue', Em.K);
- sinon.stub(controller, 'addHostPrincipals', Em.K);
- sinon.stub(App.Service, 'find', function () {
- return [
- {serviceName: 'HDFS'}
- ];
- });
-
- controller.loadStep();
- expect(controller.get('installedServices')).to.eql(['HDFS']);
- expect(controller.clearStep.calledOnce).to.be.true;
- expect(controller.loadUsers.calledOnce).to.be.true;
- expect(controller.addUserPrincipals.calledWith(['service1'], ['user1'])).to.be.true;
- expect(controller.addHostPrincipals.calledOnce).to.be.true;
- expect(controller.renderServiceConfigs.calledWith(['service1'])).to.be.true;
- expect(controller.changeCategoryOnHa.calledWith(['service1'], [{}])).to.be.true;
- expect(controller.setStoredConfigsValue.calledWith(['config1'])).to.be.true;
-
- controller.clearStep.restore();
- controller.loadUsers.restore();
- controller.addUserPrincipals.restore();
- controller.renderServiceConfigs.restore();
- controller.changeCategoryOnHa.restore();
- controller.setStoredConfigsValue.restore();
- controller.addHostPrincipals.restore();
- App.Service.find.restore();
- });
- });
-
- describe('#setStoredConfigsValue()', function () {
- it('storedConfigProperties is null', function () {
- expect(controller.setStoredConfigsValue(null)).to.be.false;
- });
- it('stepConfigs is empty', function () {
- controller.set('stepConfigs', []);
- expect(controller.setStoredConfigsValue([])).to.be.true;
- expect(controller.get('stepConfigs')).to.be.empty;
- });
- it('stepConfig has no configs', function () {
- controller.set('stepConfigs', [Em.Object.create({
- configs: []
- })]);
- expect(controller.setStoredConfigsValue([])).to.be.true;
- expect(controller.get('stepConfigs')[0].get('configs')).to.be.empty;
- });
- it('stepConfig has no stored configs', function () {
- controller.set('stepConfigs', [Em.Object.create({
- configs: [Em.Object.create({
- name: 'config1',
- value: 'value1'
- })]
- })]);
- var storedConfigProperties = [
- {
- name: 'config2',
- value: "value2"
- }
- ];
- expect(controller.setStoredConfigsValue(storedConfigProperties)).to.be.true;
- expect(controller.get('stepConfigs')[0].get('configs').findProperty('name', 'config1').get('value')).to.equal('value1');
- });
- it('stepConfig has stored configs', function () {
- controller.set('stepConfigs', [Em.Object.create({
- configs: [Em.Object.create({
- name: 'config2',
- value: 'value1'
- })]
- })]);
- var storedConfigProperties = [
- {
- name: 'config2',
- value: "value2"
- }
- ];
- expect(controller.setStoredConfigsValue(storedConfigProperties)).to.be.true;
- expect(controller.get('stepConfigs')[0].get('configs').findProperty('name', 'config2').get('value')).to.equal('value2');
- });
- });
-
- describe('#renderServiceConfigs()', function () {
- it('serviceConfigs and stepConfigs are empty', function () {
- controller.set('stepConfigs', []);
- controller.renderServiceConfigs([]);
- expect(controller.get('selectedService')).to.be.undefined;
- });
- it('serviceConfigs is empty', function () {
- controller.set('stepConfigs', [
- {showConfig: true}
- ]);
- controller.renderServiceConfigs([]);
- expect(controller.get('selectedService')).to.eql({showConfig: true});
- });
- it('serviceConfigs has service', function () {
- var serviceConfigs = [
- {
- serviceName: 'HDFS',
- configs: []
- }
- ];
- sinon.stub(controller, 'wrapConfigProperties', function () {
- return [];
- });
- controller.set('stepConfigs', []);
- controller.renderServiceConfigs(serviceConfigs);
- expect(controller.get('selectedService').get('serviceName')).to.equal('HDFS');
- expect(controller.get('selectedService').get('showConfig')).to.be.true;
- expect(controller.get('selectedService').get('configs')).to.be.empty;
- expect(controller.wrapConfigProperties.calledWith({
- serviceName: 'HDFS',
- configs: []
- })).to.be.true;
- controller.wrapConfigProperties.restore();
- });
- });
-
- describe('#wrapConfigProperties()', function () {
- it('_componentConfig is empty', function () {
- expect(controller.wrapConfigProperties({configs: []})).to.be.empty;
- });
- it('serviceConfigs has service', function () {
- var mock = Em.Object.create({
- validate: Em.K,
- isReconfigurable: true,
- isEditable: false
- });
- var _componentConfig = {configs: [
- {name: 'config1'}
- ]};
- sinon.stub(App.ServiceConfigProperty, 'create', function () {
- return mock;
- });
- sinon.spy(mock, 'validate');
- expect(controller.wrapConfigProperties(_componentConfig)[0].get('isEditable')).to.be.true;
- expect(App.ServiceConfigProperty.create.calledWith({name: 'config1'})).to.be.true;
- expect(mock.validate.calledOnce).to.be.true;
- mock.validate.restore();
- App.ServiceConfigProperty.create.restore();
- });
- });
-
- describe('#setHostsToConfig()', function () {
- it('service is null', function () {
- expect(controller.setHostsToConfig(null)).to.be.false;
- });
- it('service.configs is empty', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: []
- }
- ]);
- expect(controller.setHostsToConfig('HDFS')).to.be.false;
- });
- it('No such config name in service.configs', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1'
- }
- ]
- }
- ]);
- expect(controller.setHostsToConfig('HDFS', 'config2')).to.be.false;
- });
- it('Correct config in service.configs', function () {
- sinon.stub(App.Service, 'find', function () {
- return Em.Object.create({
- hostComponents: [
- Em.Object.create({
- componentName: 'comp1',
- hostName: 'host1'
- })
- ]
- });
- });
- expect(controller.setHostsToConfig('HDFS', 'config1', ['comp1'])).to.be.true;
- expect(controller.get('content.services')[0].configs[0].defaultValue).to.eql(['host1']);
- App.Service.find.restore();
- });
- });
-
- describe('#setHostToPrincipal()', function () {
- it('service is null', function () {
- expect(controller.setHostToPrincipal(null)).to.be.false;
- });
- it('service.configs is empty', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: []
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS')).to.be.false;
- });
- it('No such hostConfigName name in service.configs', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1'
- }
- ]
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS', 'config2', 'config1')).to.be.false;
- });
- it('No such principalConfigName name in service.configs', function () {
- expect(controller.setHostToPrincipal('HDFS', 'config1', 'config2')).to.be.false;
- });
- it('Correct config in service.configs', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1',
- defaultValue: 'value1'
- },
- {
- name: 'principal1'
- }
- ]
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS', 'config1', 'principal1', 'name1')).to.be.true;
- 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('Correct config in service.configs, defaultValue is array', function () {
- controller.set('content.services', [
- {
- serviceName: 'HDFS',
- configs: [
- {
- name: 'config1',
- defaultValue: ['Value1']
- },
- {
- name: 'principal1'
- }
- ]
- }
- ]);
- expect(controller.setHostToPrincipal('HDFS', 'config1', 'principal1', 'name1')).to.be.true;
- // 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 () {
-
- afterEach(function () {
- App.router.get.restore();
- });
-
- it('serviceUsers is correct', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: [
- {}
- ]})
- });
- controller.loadUsers();
- expect(controller.get('securityUsers')).to.eql([
- {}
- ]);
- });
- it('serviceUsers is null, testMode = true', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: null})
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers').mapProperty('name')).to.eql(["hdfs_user",
- "mapred_user",
- "hbase_user",
- "hive_user",
- "smokeuser"
- ]);
- App.get.restore();
- });
- it('serviceUsers is empty, testMode = true', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: []})
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers').mapProperty('name')).to.eql(["hdfs_user",
- "mapred_user",
- "hbase_user",
- "hive_user",
- "smokeuser"
- ]);
- App.get.restore();
- });
- it('serviceUsers is null, testMode = false', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: null})
- });
- sinon.stub(App.db, 'getSecureUserInfo', function () {
- return [
- {}
- ];
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers')).to.eql([
- {}
- ]);
- expect(App.db.getSecureUserInfo.calledOnce).to.be.true;
- App.db.getSecureUserInfo.restore();
- App.get.restore();
- });
- it('serviceUsers is empty, testMode = false', function () {
- sinon.stub(App.router, 'get', function () {
- return Em.Object.create({serviceUsers: []})
- });
- sinon.stub(App.db, 'getSecureUserInfo', function () {
- return [
- {}
- ];
- });
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
- controller.loadUsers();
- expect(controller.get('securityUsers')).to.eql([
- {}
- ]);
- expect(App.db.getSecureUserInfo.calledOnce).to.be.true;
- App.db.getSecureUserInfo.restore();
- App.get.restore();
- });
- });
-
- describe('#addUserPrincipals()', function () {
- beforeEach(function () {
- sinon.stub(controller, 'setUserPrincipalValue', function () {
- return true;
- });
- });
- afterEach(function () {
- controller.setUserPrincipalValue.restore();
- });
-
- var generalConfigs = [
- {
- serviceName: 'GENERAL',
- configs: [
- {
- name: 'hbase_principal_name',
- isVisible: false
- },
- {
- name: 'hbase_user_keytab',
- isVisible: false
- },
- {
- name: 'hdfs_principal_name',
- isVisible: false
- },
- {
- name: 'hdfs_user_keytab',
- isVisible: false
- }
- ]
- }
- ];
- var securityUsers = [];
-
- it('HBASE or HDFS services are not installed neither', function () {
- var serviceConfigs = generalConfigs.slice(0);
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.false;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.false;
- });
- it('HBASE service is installed', function () {
- var serviceConfigs = generalConfigs.slice(0);
- serviceConfigs.push({serviceName: 'HBASE'});
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.true;
- });
- it('HDFS service is installed', function () {
- var serviceConfigs = generalConfigs.slice(0);
- serviceConfigs.push({serviceName: 'HDFS'});
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_user_keytab').isVisible).to.be.true;
- });
- it('HDFS and HBASE services are installed', function () {
- var serviceConfigs = generalConfigs.slice(0);
- serviceConfigs.push({serviceName: 'HDFS'});
- serviceConfigs.push({serviceName: 'HBASE'});
- controller.addUserPrincipals(serviceConfigs, securityUsers);
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_user_keytab').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.true;
- expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.true;
- });
- });
-
- describe('#setUserPrincipalValue()', function () {
- it('user and userPrincipal are null', function () {
- expect(controller.setUserPrincipalValue(null, null)).to.be.false;
- });
- it('user is null', function () {
- expect(controller.setUserPrincipalValue(null, {})).to.be.false;
- });
- it('userPrincipal is null', function () {
- expect(controller.setUserPrincipalValue({}, null)).to.be.false;
- });
- it('user and userPrincipal are correct', function () {
- var user = {value: 'value1'};
- var userPrincipal = {};
- expect(controller.setUserPrincipalValue(user, userPrincipal)).to.be.true;
- expect(userPrincipal.defaultValue).to.equal('value1');
- });
- });
-
- describe('#addHostPrincipals()', function () {
- it('hostToPrincipalMap is empty', function () {
- sinon.stub(controller, 'setHostToPrincipal', Em.K);
- controller.set('hostToPrincipalMap', []);
- controller.addHostPrincipals();
- expect(controller.setHostToPrincipal.called).to.be.false;
- controller.setHostToPrincipal.restore();
- });
- it('Correct data', function () {
- sinon.stub(controller, 'setHostToPrincipal', Em.K);
- controller.set('hostToPrincipalMap', [
- {
- serviceName: 'HDFS',
- configName: 'datanode_hosts',
- principalName: 'principal1',
- primaryName: 'name1'
- }
- ]);
- controller.addHostPrincipals();
- expect(controller.setHostToPrincipal.calledWith('HDFS', 'datanode_hosts', 'principal1', 'name1')).to.be.true;
- controller.setHostToPrincipal.restore();
- });
- });
-
- describe('#changeCategoryOnHa()', function () {
-
- beforeEach(function () {
- sinon.stub(controller, 'removeConfigCategory', Em.K);
- });
- afterEach(function () {
- controller.removeConfigCategory.restore();
- });
-
- var serviceConfigs = [{
- serviceName: 'HDFS',
- configCategories: []
- }];
- var stepConfigs = [Em.Object.create({
- serviceName: 'HDFS',
- configs: []
- })];
-
- it('HDFS service is absent', function () {
- expect(controller.changeCategoryOnHa([], [])).to.be.false;
- });
- it('HDFS service installed, App.testMode and App.testNameNodeHA - true', function () {
- sinon.stub(App, 'get', function(k) {
- if ('testMode' === k) return true;
- if ('testNameNodeHA' === k) return true;
- return Em.get(App, k);
- });
- expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
- expect(controller.removeConfigCategory.calledWith([], [], 'SNameNode')).to.be.true;
- App.get.restore();
- });
- it('HDFS service installed, content.isNnHa = true', function () {
- controller.set('content.isNnHa', 'true');
- expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
- expect(controller.removeConfigCategory.calledWith([], [], 'SNameNode')).to.be.true;
- });
- it('HDFS service installed, HA disabled', function () {
- controller.set('content.isNnHa', 'false');
- expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
- expect(controller.removeConfigCategory.calledWith([], [], 'JournalNode')).to.be.true;
- });
- });
-
- describe('#removeConfigCategory()', function () {
- it('properties should be hidden', function () {
- var properties = [
- Em.Object.create({
- category: 'comp1',
- isVisible: true
- })
- ];
- controller.removeConfigCategory(properties, [], 'comp1');
- expect(properties[0].isVisible).to.be.false;
- });
- it('category should be removed', function () {
- var configCategories = [
- Em.Object.create({
- name: 'comp1'
- })
- ];
- controller.removeConfigCategory([], configCategories, 'comp1');
- expect(configCategories).to.be.empty;
- });
- });
-});