Author: yusaku
Date: Mon Jun 10 02:35:05 2013
New Revision: 1491327
URL: http://svn.apache.org/r1491327
Log:
AMBARI-2337. Security Wizard: navigation not locked down, causes artifacts, and
other unwanted side effects. (jaimin via yusaku)
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js
incubator/ambari/trunk/ambari-web/app/data/HDP2/config_properties.js
incubator/ambari/trunk/ambari-web/app/data/config_properties.js
incubator/ambari/trunk/ambari-web/app/data/secure_configs.js
incubator/ambari/trunk/ambari-web/app/routes/add_security.js
incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/menu.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/service/reconfigure.hbs
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security.js
Mon Jun 10 02:35:05 2013
@@ -111,7 +111,7 @@ App.MainAdminSecurityController = Em.Con
getServiceConfigsFromServerSuccessCallback: function (data) {
console.log("TRACE: In success function for the GET
getServiceConfigsFromServer call");
var configs = data.items.findProperty('tag', this.get('tag')).properties;
- if (configs && configs['security_enabled'] === 'true') {
+ if (configs && (configs['security_enabled'] === 'true'
||configs['security_enabled'] === true)) {
this.set('securityEnabled', true);
}
else {
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/addSecurity_controller.js
Mon Jun 10 02:35:05 2013
@@ -27,15 +27,7 @@ App.AddSecurityController = App.WizardCo
content: Em.Object.create({
services: [],
serviceConfigProperties: null,
- controllerName: 'addSecurityController',
-
- saveCurrentStage: function (stage) {
- App.db.setSecurityStage(stage);
- },
-
- loadCurrentStage: function () {
- return App.db.getSecurityStage();
- }
+ controllerName: 'addSecurityController'
}),
/**
@@ -45,7 +37,6 @@ App.AddSecurityController = App.WizardCo
var step = this.get('currentStep');
switch (step) {
case '3':
- this.loadStages();
case '2':
this.loadServiceConfigs();
case '1':
@@ -60,14 +51,6 @@ App.AddSecurityController = App.WizardCo
},
/**
- * loads the status of stages of step3 from localDb
- */
-
- loadStages: function () {
-
- },
-
- /**
* Loads all installed services
*/
loadServices: function () {
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/add/step3.js
Mon Jun 10 02:35:05 2013
@@ -20,7 +20,7 @@ var App = require('app');
App.MainAdminSecurityAddStep3Controller = Em.Controller.extend({
name: 'mainAdminSecurityAddStep3Controller',
- configMapping: require('data/secure_mapping'),
+ secureMapping: require('data/secure_mapping'),
stages: [],
configs: [],
noOfWaitingAjaxCalls: 0,
@@ -63,10 +63,11 @@ App.MainAdminSecurityAddStep3Controller
},
loadStep: function () {
+ this.set('secureMapping',require('data/secure_mapping').slice(0));
var stages = App.db.getSecurityDeployStages();
this.prepareSecureConfigs();
+ this.clearStep();
if (stages === undefined) {
- this.clearStep();
this.loadStages();
this.addInfoToStages();
} else {
@@ -91,32 +92,31 @@ App.MainAdminSecurityAddStep3Controller
enableSubmit: function () {
if (this.get('stages').someProperty('isError', true) ||
this.get('stages').everyProperty('isSuccess', true)) {
this.set('isSubmitDisabled', false);
- App.router.get('addSecurityController').setStepsEnable();
}
}.observes('[email protected]'),
updateServices: function () {
this.services.clear();
var services = this.get("services");
- this.get("stages").forEach(function (stages) {
+ this.get("stages").forEach(function (stage) {
var newService = Ember.Object.create({
- name: stages.label,
+ name: stage.label,
hosts: []
});
- if (stages && stages.get("polledData")) {
- var hostNames =
stages.get("polledData").mapProperty('Tasks.host_name').uniq();
+ if (stage && stage.get("polledData")) {
+ var hostNames =
stage.get("polledData").mapProperty('Tasks.host_name').uniq();
hostNames.forEach(function (name) {
newService.hosts.push({
name: name,
publicName: name,
- logTasks: stages.polledData.filterProperty("Tasks.host_name", name)
+ logTasks: stage.polledData.filterProperty("Tasks.host_name", name)
});
});
services.push(newService);
}
});
this.set('serviceTimestamp', new Date().getTime());
- }.observes("[email protected]"),
+ }.observes('[email protected]'),
loadStages: function () {
this.get('stages').pushObjects([
@@ -193,7 +193,7 @@ App.MainAdminSecurityAddStep3Controller
loadUiSideConfigs: function () {
var uiConfig = [];
- var configs = this.get('configMapping').filterProperty('foreignKey', null);
+ var configs = this.get('secureMapping').filterProperty('foreignKey', null);
configs.forEach(function (_config) {
var value = this.getGlobConfigValue(_config.templateName, _config.value,
_config.name);
uiConfig.pushObject({
@@ -212,7 +212,7 @@ App.MainAdminSecurityAddStep3Controller
var globalProperty = this.get('globalProperties').findProperty('name',
name);
newValue = globalProperty.value;
var isInstanceName = this.get('globalProperties').findProperty('name',
'instance_name');
- if (isInstanceName) {
+ if (isInstanceName === true || isInstanceName === 'true') {
if (/primary_name?$/.test(globalProperty.name) && property !==
'hadoop.security.auth_to_local' && property !==
'oozie.authentication.kerberos.name.rules') {
if (this.get('isOozieSelected') && (property ===
'oozie.service.HadoopAccessorService.kerberos.principal' || property ===
'oozie.authentication.kerberos.principal')) {
var oozieServerName =
App.Service.find('OOZIE').get('hostComponents').findProperty('componentName',
'OOZIE_SERVER').get('host.hostName');
@@ -257,7 +257,7 @@ App.MainAdminSecurityAddStep3Controller
} else {
/*
console.log("ERROR: The variable name is: " + templateName[index]);
- console.log("ERROR: mapped config from configMapping file has no
corresponding variable in " +
+ console.log("ERROR: mapped config from secureMapping file has no
corresponding variable in " +
"content.serviceConfigProperties. Two possible reasons for the error
could be: 1) The service is not selected. " +
"and/OR 2) The service_config metadata file has no corresponding
global var for the site property variable");
*/
@@ -378,7 +378,6 @@ App.MainAdminSecurityAddStep3Controller
this.set('noOfWaitingAjaxCalls', this.get('noOfWaitingAjaxCalls') - 1);
if (this.get('noOfWaitingAjaxCalls') == 0) {
App.router.get('mainAdminSecurityController').setAddSecurityWizardStatus(null);
- App.router.get('addSecurityController').setCurrentStep(1);
var currentStage = this.get('stages').findProperty('stage', 'stage3');
currentStage.set('isSuccess', true);
}
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/admin/security/disable.js
Mon Jun 10 02:35:05 2013
@@ -42,14 +42,14 @@ App.MainAdminSecurityDisableController =
loadStep: function () {
var stages = App.db.getSecurityDeployStages();
+ this.clearStep();
if (stages === undefined) {
- this.clearStep();
this.loadStages();
this.addInfoToStages();
} else {
- stages.forEach(function(_stage,index){
+ stages.forEach(function (_stage, index) {
stages[index] = App.Poll.create(_stage);
- },this);
+ }, this);
if (stages.someProperty('isError', true)) {
var failedStages = stages.filterProperty('isError', true);
failedStages.setEach('isError', false);
@@ -61,8 +61,8 @@ App.MainAdminSecurityDisableController =
}
this.get('stages').pushObjects(stages);
}
- this.loadSecureServices();
- this.moveToNextStage();
+ this.loadSecureServices();
+ this.moveToNextStage();
},
@@ -85,7 +85,6 @@ App.MainAdminSecurityDisableController =
enableSubmit: function () {
if (this.get('stages').someProperty('isError', true) ||
this.get('stages').everyProperty('isSuccess', true)) {
this.set('isSubmitDisabled', false);
- App.router.get('addSecurityController').setStepsEnable();
}
}.observes('[email protected]'),
@@ -120,23 +119,25 @@ App.MainAdminSecurityDisableController =
updateServices: function () {
this.services.clear();
var services = this.get("services");
- this.get("stages").forEach(function (stages) {
+ this.get("stages").forEach(function (stage) {
var newService = Ember.Object.create({
- name: stages.label,
+ name: stage.label,
hosts: []
});
- var hostNames =
stages.get("polledData").mapProperty('Tasks.host_name').uniq();
- hostNames.forEach(function (name) {
- newService.hosts.push({
- name: name,
- publicName: name,
- logTasks: stages.polledData.filterProperty("Tasks.host_name", name)
+ if (stage && stage.get("polledData")) {
+ var hostNames =
stage.get("polledData").mapProperty('Tasks.host_name').uniq();
+ hostNames.forEach(function (name) {
+ newService.hosts.push({
+ name: name,
+ publicName: name,
+ logTasks: stage.polledData.filterProperty("Tasks.host_name", name)
+ });
});
- });
- services.push(newService);
+ services.push(newService);
+ }
});
this.set('serviceTimestamp', new Date().getTime());
- }.observes("[email protected]"),
+ }.observes('[email protected]'),
addInfoToStages: function () {
this.addInfoToStage2();
@@ -303,7 +304,7 @@ App.MainAdminSecurityDisableController =
delete _serviceConfigTags.configs[_config.name];
}
}, this);
- _serviceConfigTags.configs.security_enabled = false;
+ _serviceConfigTags.configs.security_enabled = 'false';
} else {
this.get('secureMapping').filterProperty('filename',
_serviceConfigTags.siteName + '.xml').forEach(function (_config) {
var configName = _config.name;
@@ -340,9 +341,9 @@ App.MainAdminSecurityDisableController =
}, this);
},
- saveStages: function() {
+ saveStages: function () {
var stages = [];
- this.get('stages').forEach(function(_stage){
+ this.get('stages').forEach(function (_stage) {
var stage = {
stage: _stage.get('stage'),
label: _stage.get('label'),
@@ -355,8 +356,8 @@ App.MainAdminSecurityDisableController =
data: _stage.get('data')
};
stages.pushObject(stage);
- },this);
+ }, this);
App.db.setSecurityDeployStages(stages);
-
}.observes('[email protected]','[email protected]','[email protected]')
+ }.observes('[email protected]', '[email protected]',
'[email protected]')
});
Modified: incubator/ambari/trunk/ambari-web/app/data/HDP2/config_properties.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/HDP2/config_properties.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/HDP2/config_properties.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/data/HDP2/config_properties.js Mon
Jun 10 02:35:05 2013
@@ -403,7 +403,7 @@ module.exports =
"name": "security_enabled",
"displayName": "Hadoop Security",
"description": "Enable hadoop security",
- "defaultValue": false,
+ "defaultValue": 'false',
"isRequired": false,
"displayType": "checkbox",
"isOverridable": false,
Modified: incubator/ambari/trunk/ambari-web/app/data/config_properties.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/config_properties.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/config_properties.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/config_properties.js Mon Jun 10
02:35:05 2013
@@ -416,7 +416,7 @@ module.exports =
"name": "security_enabled",
"displayName": "Hadoop Security",
"description": "Enable hadoop security",
- "defaultValue": false,
+ "defaultValue": 'false',
"isRequired": false,
"displayType": "checkbox",
"isOverridable": false,
Modified: incubator/ambari/trunk/ambari-web/app/data/secure_configs.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/secure_configs.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/secure_configs.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/secure_configs.js Mon Jun 10
02:35:05 2013
@@ -30,7 +30,6 @@ module.exports = [
configCategories: [
App.ServiceConfigCategory.create({ name: 'KERBEROS', displayName:
'General'})
],
- sites: ['global'],
configs: configProperties.filterProperty('serviceName', 'GENERAL')
},
{
Modified: incubator/ambari/trunk/ambari-web/app/routes/add_security.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/routes/add_security.js?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/routes/add_security.js (original)
+++ incubator/ambari/trunk/ambari-web/app/routes/add_security.js Mon Jun 10
02:35:05 2013
@@ -50,7 +50,6 @@ module.exports = Em.Route.extend({
mainAdminSecurityController.setAddSecurityWizardStatus(null);
App.db.setSecurityDeployStages(undefined);
router.get('addSecurityController').setCurrentStep(1);
- router.get('addSecurityController.content').saveCurrentStage(2);
router.transitionTo('adminSecurity.index');
}
},
@@ -100,7 +99,6 @@ module.exports = Em.Route.extend({
var addSecurityController = router.get('addSecurityController');
var addSecurityStep2Controller =
router.get('mainAdminSecurityAddStep2Controller');
addSecurityController.saveServiceConfigProperties(addSecurityStep2Controller);
- addSecurityController.get('content').saveCurrentStage('2');
App.db.setSecurityDeployStages(undefined);
router.transitionTo('step3');
}
@@ -113,8 +111,8 @@ module.exports = Em.Route.extend({
var controller = router.get('addSecurityController');
controller.dataLoading().done(function () {
controller.setCurrentStep('3');
- controller.setLowerStepsDisable(3);
controller.loadAllPriorSteps();
+ controller.setLowerStepsDisable(3);
controller.connectOutlet('mainAdminSecurityAddStep3',
controller.get('content'));
})
},
Modified:
incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/menu.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/menu.hbs?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/menu.hbs
(original)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/admin/security/add/menu.hbs
Mon Jun 10 02:35:05 2013
@@ -26,9 +26,9 @@
<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}}>{{t admin.security.step1.header}}</a></li>
- <li {{bindAttr class="isStep2:active
view.isStep2Disabled:disabled"}}><a href="javascript:void(null);" {{action
gotoStep2}}>{{t admin.security.step2.header}}</a></li>
- <li {{bindAttr class="isStep3:active
view.isStep3Disabled:disabled"}}><a href="javascript:void(null);" {{action
gotoStep3}}>{{t admin.security.step3.header}}</a></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>
</ul>
</div>
</div>
Modified:
incubator/ambari/trunk/ambari-web/app/templates/main/service/reconfigure.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/reconfigure.hbs?rev=1491327&r1=1491326&r2=1491327&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/service/reconfigure.hbs
(original)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/service/reconfigure.hbs
Mon Jun 10 02:35:05 2013
@@ -22,7 +22,7 @@
{{#view App.StageStatusView}}
<td>
{{#if stage.isPolling}}
- <a href="javascript:void(0)" {{action "showHostPopup" stage.label
target="view"}}>
+ <a href="javascript:void(0)" {{action "showHostPopup" stage.label
target="view"}}>
{{/if}}
<p {{bindAttr class="stage.hasStarted::faintText"}}>{{stage.label}}</p>
{{#if stage.isPolling}}
@@ -34,7 +34,9 @@
{{#if stage.isSuccess}}
{{view App.StageSuccessView}}
{{else}}
- {{view App.StageFailureView}}
+ {{#if stage.isError}}
+ {{view App.StageFailureView}}
+ {{/if}}
{{/if}}
{{else}}
{{#if stage.isStarted}}
@@ -50,4 +52,4 @@
{{/view}}
{{/each}}
</tbody>
-</table>
+</table>
\ No newline at end of file