regenerateKeytabs
* show background operations popup if appropriate option is set
*/
regenerateKeytabsSuccess: function () {
App.router.get('applicationController').dataLoading().done(function (initValue) {
if (initValue) {
App.router.get('backgroundOperationsController').showPopup();
}
});
},
getUpdatedSecurityStatus: function () {
this.getSecurityStatus();
return this.get('securityEnabled');
},
/**
* performs cluster check before kerbefos security
* wizard starts if preKerberizeCheck supports is true
* otherwise runs startKerberosWizard
* @method checkAndStartKerberosWizard
*/
checkAndStartKerberosWizard: function() {
if (App.get('supports.preKerberizeCheck')) {
App.ajax.send({
name: "admin.kerberos_security.checks",
sender: this,
success: "runSecurityCheckSuccess"
});
} else {
this.startKerberosWizard();
}
},
/**
* success callback of checkAndStartKerberosWizard()
* if there are some fails - it shows popup else open security wizard
* @param data {object}
* @param opt {object}
* @param params {object}
* @returns {App.ModalPopup|undefined}
*/
runSecurityCheckSuccess: function (data, opt, params) {
//TODO correct check
if (data.items.someProperty('UpgradeChecks.status', "FAIL")) {
var header = Em.I18n.t('popup.clusterCheck.Security.header').format(params.label);
var title = Em.I18n.t('popup.clusterCheck.Security.title');
var alert = Em.I18n.t('popup.clusterCheck.Security.alert');
App.showClusterCheckPopup(data, header, title, alert);
} else {
this.startKerberosWizard();
}
},
startKerberosWizard: function () {
this.setAddSecurityWizardStatus('RUNNING');
App.router.transitionTo('adminKerberos.adminAddKerberos');
},
/**
* Loads the security status from server (security_enabled property in cluster-env configuration)
*/
loadSecurityStatusFromServer: function () {
if (App.get('testMode')) {
this.set('securityEnabled', !App.get('testEnableSecurity'));
this.set('dataIsLoaded', true);
} else {
//get Security Status From Server
return this.getSecurityStatus();
}
},
/**
* Load security status from server.
* @returns {$.Deferred}
*/
getSecurityStatus: function () {
if (App.get('testMode')) {
this.set('securityEnabled', !App.get('testEnableSecurity'));
this.set('dataIsLoaded', true);
} else {
//get Security Status From Server
return App.ajax.send({
name: 'admin.security_status',
sender: this,
success: 'getSecurityStatusSuccessCallback',
error: 'errorCallback'
});
}
},
getSecurityStatusSuccessCallback: function(data) {
this.set('dataIsLoaded', true);
var securityType = data.Clusters.security_type;
this.set('securityEnabled', securityType === 'KERBEROS');
},
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();
}
},
showSecurityErrorPopup: function () {
App.ModalPopup.show({
header: Em.I18n.t('common.error'),
secondary: false,
bodyClass: Ember.View.extend({
template: Ember.Handlebars.compile('{{t admin.security.status.error}}
')
})
});
},
/**
* Override App.KerberosWizardStep4Controller
*
* @param {App.ServiceConfigProperty[]} properties
*/
setStepConfigs: function (properties) {
this.get('stepConfigs').clear();
this._super(properties);
},
/**
* Override App.KerberosWizardStep4Controller
*
* @param {App.ServiceConfigProperty[]} configs
* @returns {App.ServiceConfigProperty[]}
*/
prepareConfigProperties: function(configs) {
var configProperties = configs.slice(0);
var siteProperties = App.config.get('preDefinedSiteProperties');
var installedServiceNames = ['Cluster'].concat(App.Service.find().mapProperty('serviceName'));
configProperties = configProperties.filter(function(item) {
return installedServiceNames.contains(item.get('serviceName'));
});
configProperties.setEach('isSecureConfig', false);
configProperties.forEach(function(property, item, allConfigs) {
if (property.get('observesValueFrom')) {
var observedValue = allConfigs.findProperty('name', property.get('observesValueFrom')).get('value');
property.set('value', observedValue);
property.set('defaultValue', observedValue);
}
if (property.get('serviceName') == 'Cluster') {
property.set('category', 'Global');
} else {
property.set('category', property.get('serviceName'));
}
// All user identity should be grouped under "Ambari Principals" category
if (property.get('identityType') == 'user') property.set('category', 'Ambari Principals');
var siteProperty = siteProperties.findProperty('name', property.get('name'));
if (siteProperty) {
if (siteProperty.category === property.get('category')) {
property.set('displayName',siteProperty.displayName);
if (siteProperty.index) {
property.set('index', siteProperty.index);
}
}
}
});
configProperties.setEach('isEditable', false);
return configProperties;
}
});