step4.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.MainAdminSecurityAddStep4Controller = Em.Controller.extend({
  20. name: 'mainAdminSecurityAddStep4Controller',
  21. secureMapping: require('data/secure_mapping'),
  22. secureProperties: require('data/secure_properties').configProperties,
  23. stages: [],
  24. configs: [],
  25. noOfWaitingAjaxCalls: 0,
  26. secureServices: [],
  27. serviceConfigTags: [],
  28. globalProperties: [],
  29. isSubmitDisabled: true,
  30. isBackBtnDisabled: true,
  31. isOozieSelected: function () {
  32. return this.get('content.services').someProperty('serviceName', 'OOZIE');
  33. }.property('content.services'),
  34. isHiveSelected: function () {
  35. return this.get('content.services').someProperty('serviceName', 'HIVE');
  36. }.property('content.services'),
  37. isNagiosSelected: function () {
  38. return this.get('content.services').someProperty('serviceName', 'NAGIOS');
  39. }.property('content.services'),
  40. isZkSelected: function () {
  41. return this.get('content.services').someProperty('serviceName', 'ZOOKEEPER');
  42. }.property('content.services'),
  43. isWebHcatSelected: function () {
  44. var installedServices = App.Service.find().mapProperty('serviceName');
  45. return installedServices.contains('WEBHCAT');
  46. },
  47. serviceUsersBinding: 'App.router.mainAdminSecurityController.serviceUsers',
  48. hasHostPopup: true,
  49. services: [],
  50. serviceTimestamp: null,
  51. isSecurityApplied: function () {
  52. return this.get('stages').someProperty('stage', 'stage3') && this.get('stages').findProperty('stage', 'stage3').get('isSuccess');
  53. }.property('stages.@each.isCompleted'),
  54. clearStep: function () {
  55. this.get('stages').clear();
  56. this.set('isSubmitDisabled', true);
  57. this.set('isBackBtnDisabled', true);
  58. this.get('serviceConfigTags').clear();
  59. },
  60. loadStep: function () {
  61. this.set('secureMapping', require('data/secure_mapping').slice(0));
  62. var stages = App.db.getSecurityDeployStages();
  63. this.clearStep();
  64. this.prepareSecureConfigs();
  65. if (stages && stages.length > 0) {
  66. stages.forEach(function (_stage, index) {
  67. stages[index] = App.Poll.create(_stage);
  68. }, this);
  69. var stopServices = stages.findProperty('name', 'STOP_SERVICES');
  70. var runningOperation = App.router.get('backgroundOperationsController.services').findProperty('isRunning');
  71. if(stopServices.get('isStarted')){
  72. if(stopServices.get('isCompleted') || !runningOperation || !(runningOperation.get('name') === 'Stop All Services')){
  73. stopServices.set('requestId', undefined);
  74. stopServices.set('isError', false);
  75. stopServices.set('isSuccess', false);
  76. stopServices.set('isStarted', false);
  77. }
  78. }
  79. if (stages.someProperty('isError', true)) {
  80. var failedStages = stages.filterProperty('isError', true);
  81. failedStages.setEach('isError', false);
  82. failedStages.setEach('isStarted', false);
  83. } else if (stages.filterProperty('isStarted', true).someProperty('isCompleted', false)) {
  84. var runningStage = stages.filterProperty('isStarted', true).findProperty('isCompleted', false);
  85. runningStage.set('isStarted', false);
  86. }
  87. this.get('stages').pushObjects(stages);
  88. } else {
  89. this.loadStages();
  90. this.addInfoToStages();
  91. var runningOperations = App.router.get('backgroundOperationsController.services').filterProperty('isRunning');
  92. var stopAllOperation = runningOperations.findProperty('name', 'Stop All Services');
  93. var stopStage = this.get('stages').findProperty('name', 'STOP_SERVICES');
  94. if (stopStage.get('name') === 'STOP_SERVICES' && stopAllOperation) {
  95. stopStage.set('requestId', stopAllOperation.get('id'));
  96. }
  97. }
  98. this.moveToNextStage();
  99. },
  100. enableSubmit: function () {
  101. if (this.get('stages').someProperty('isError', true) || this.get('stages').everyProperty('isSuccess', true)) {
  102. this.set('isSubmitDisabled', false);
  103. if (this.get('stages').someProperty('isError', true)) {
  104. this.set('isBackBtnDisabled', false);
  105. App.router.get('addSecurityController').setStepsEnable();
  106. }
  107. } else {
  108. this.set('isSubmitDisabled', true);
  109. }
  110. }.observes('stages.@each.isCompleted'),
  111. updateServices: function () {
  112. this.services.clear();
  113. var services = this.get("services");
  114. this.get("stages").forEach(function (stage) {
  115. var newService = Ember.Object.create({
  116. name: stage.label,
  117. hosts: []
  118. });
  119. if (stage && stage.get("polledData")) {
  120. var hostNames = stage.get("polledData").mapProperty('Tasks.host_name').uniq();
  121. hostNames.forEach(function (name) {
  122. newService.hosts.push({
  123. name: name,
  124. publicName: name,
  125. logTasks: stage.polledData.filterProperty("Tasks.host_name", name)
  126. });
  127. });
  128. services.push(newService);
  129. }
  130. });
  131. this.set('serviceTimestamp', new Date().getTime());
  132. }.observes('stages.@each.polledData'),
  133. loadStages: function () {
  134. this.get('stages').pushObjects([
  135. App.Poll.create({stage: 'stage2', label: Em.I18n.translations['admin.addSecurity.apply.stage2'], isPolling: true, name: 'STOP_SERVICES'}),
  136. App.Poll.create({stage: 'stage3', label: Em.I18n.translations['admin.addSecurity.apply.stage3'], isPolling: false, name: 'APPLY_CONFIGURATIONS'}),
  137. App.Poll.create({stage: 'stage4', label: Em.I18n.translations['admin.addSecurity.apply.stage4'], isPolling: true, name: 'START_SERVICES'})
  138. ]);
  139. },
  140. startStage: function () {
  141. var startedStages = this.get('stages').filterProperty('isStarted', true);
  142. if (startedStages.length) {
  143. var currentStage = startedStages.findProperty('isCompleted', false);
  144. if (currentStage && currentStage.get('isPolling') === true) {
  145. currentStage.start();
  146. } else if (currentStage && currentStage.get('stage') === 'stage3') {
  147. if (App.testMode) {
  148. currentStage.set('isSuccess', true);
  149. App.router.get('mainAdminSecurityController').setAddSecurityWizardStatus(null);
  150. } else {
  151. this.loadClusterConfigs()
  152. }
  153. }
  154. }
  155. }.observes('stages.@each.isStarted'),
  156. onCompleteStage: function () {
  157. var index = this.get('stages').filterProperty('isCompleted', true).length;
  158. if (index > 0) {
  159. var lastCompletedStageResult = this.get('stages').objectAt(index - 1).get('isSuccess');
  160. if (lastCompletedStageResult) {
  161. this.moveToNextStage();
  162. }
  163. }
  164. }.observes('stages.@each.isCompleted'),
  165. moveToNextStage: function () {
  166. var leftStages = this.get('stages').filterProperty('isStarted', false);
  167. var nextStage = leftStages.findProperty('isCompleted', false);
  168. if (nextStage) {
  169. nextStage.set('isStarted', true);
  170. }
  171. },
  172. addInfoToStages: function () {
  173. this.addInfoToStage2();
  174. this.addInfoToStage4();
  175. },
  176. addInfoToStage1: function () {
  177. var stage1 = this.get('stages').findProperty('stage', 'stage1');
  178. if (App.testMode) {
  179. stage1.set('isSuccess', true);
  180. stage1.set('isStarted', true);
  181. stage1.set('isCompleted', true);
  182. }
  183. },
  184. addInfoToStage2: function () {
  185. var stage2 = this.get('stages').findProperty('stage', 'stage2');
  186. var url = (App.testMode) ? '/data/wizard/deploy/2_hosts/poll_1.json' : App.apiPrefix + '/clusters/' + App.router.getClusterName() + '/services';
  187. var data = '{"RequestInfo": {"context" :"' + Em.I18n.t('requestInfo.stopAllServices') + '"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}';
  188. stage2.set('url', url);
  189. stage2.set('data', data);
  190. },
  191. addInfoToStage4: function () {
  192. var stage4 = this.get('stages').findProperty('stage', 'stage4');
  193. var url = (App.testMode) ? '/data/wizard/deploy/2_hosts/poll_1.json' : App.apiPrefix + '/clusters/' + App.router.getClusterName() + '/services?params/run_smoke_test=true';
  194. var data = '{"RequestInfo": {"context": "' + Em.I18n.t('requestInfo.startAllServices') + '"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}';
  195. stage4.set('url', url);
  196. stage4.set('data', data);
  197. },
  198. loadUiSideConfigs: function () {
  199. var uiConfig = [];
  200. var configs = this.get('secureMapping').filterProperty('foreignKey', null);
  201. configs.forEach(function (_config) {
  202. var value = _config.value;
  203. if (_config.hasOwnProperty('dependedServiceName') && _config.hasOwnProperty('replace')) {
  204. value = this.checkServiceForConfigValue(value, _config.dependedServiceName, _config.replace);
  205. }
  206. value = this.getGlobConfigValue(_config.templateName, value, _config.name);
  207. uiConfig.pushObject({
  208. "id": "site property",
  209. "name": _config.name,
  210. "value": value,
  211. "filename": _config.filename
  212. });
  213. }, this);
  214. var dependentConfig = this.get('secureMapping').filterProperty('foreignKey');
  215. dependentConfig.forEach(function (_config) {
  216. if (App.Service.find().mapProperty('serviceName').contains( _config.serviceName)) {
  217. this.setConfigValue(uiConfig, _config);
  218. uiConfig.pushObject({
  219. "id": "site property",
  220. "name": _config._name || _config.name,
  221. "value": _config.value,
  222. "filename": _config.filename
  223. });
  224. }
  225. }, this);
  226. return uiConfig;
  227. },
  228. checkServiceForConfigValue: function(value, serviceName, replace) {
  229. if (!App.Service.find().mapProperty('serviceName').contains(serviceName)) {
  230. value = value.replace(replace, '');
  231. }
  232. return value;
  233. },
  234. /**
  235. * Set all site property that are derived from other puppet-variable
  236. */
  237. getGlobConfigValue: function (templateName, expression, name) {
  238. var express = expression.match(/<(.*?)>/g);
  239. var value = expression;
  240. if (express == null) {
  241. return expression;
  242. }
  243. express.forEach(function (_express) {
  244. //console.log("The value of template is: " + _express);
  245. var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
  246. var globValue = this.get('globalProperties').findProperty('name', templateName[index]);
  247. if (globValue) {
  248. console.log('The template value of templateName ' + '[' + index + ']' + ': ' + templateName[index] + ' is: ' + globValue);
  249. if (value !== null) { // if the property depends on more than one template name like <templateName[0]>/<templateName[1]> then don't proceed to the next if the prior is null or not found in the global configs
  250. value = value.replace(_express, globValue.value);
  251. }
  252. } else {
  253. /*
  254. console.log("ERROR: The variable name is: " + templateName[index]);
  255. console.log("ERROR: mapped config from secureMapping file has no corresponding variable in " +
  256. "content.serviceConfigProperties. Two possible reasons for the error could be: 1) The service is not selected. " +
  257. "and/OR 2) The service_config metadata file has no corresponding global var for the site property variable");
  258. */
  259. value = null;
  260. }
  261. }, this);
  262. return value;
  263. },
  264. /**
  265. * Set all site property that are derived from other site-properties
  266. */
  267. setConfigValue: function (uiConfig, config) {
  268. if (config.value == null) {
  269. return;
  270. }
  271. var fkValue = config.name.match(/<(foreignKey.*?)>/g);
  272. if (fkValue) {
  273. fkValue.forEach(function (_fkValue) {
  274. var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
  275. var globalValue;
  276. if (uiConfig.someProperty('name', config.foreignKey[index])) {
  277. globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
  278. config._name = config.name.replace(_fkValue, globalValue);
  279. } else if (this.get('globalProperties').someProperty('name', config.foreignKey[index])) {
  280. globalValue = this.get('globalProperties').findProperty('name', config.foreignKey[index]).value;
  281. config._name = config.name.replace(_fkValue, globalValue);
  282. }
  283. }, this);
  284. }
  285. //For properties in the configMapping file having foreignKey and templateName properties.
  286. var templateValue = config.value.match(/<(templateName.*?)>/g);
  287. if (templateValue) {
  288. templateValue.forEach(function (_value) {
  289. var index = parseInt(_value.match(/\[([\d]*)(?=\])/)[1]);
  290. var globValue = this.get('globalProperties').findProperty('name', config.templateName[index]);
  291. if (globValue) {
  292. config.value = config.value.replace(_value, globValue.value);
  293. } else {
  294. config.value = null;
  295. }
  296. }, this);
  297. }
  298. },
  299. prepareSecureConfigs: function () {
  300. this.loadGlobals();
  301. var storedConfigs = this.get('content.serviceConfigProperties').filterProperty('id', 'site property');
  302. var uiConfigs = this.loadUiSideConfigs();
  303. this.set('configs', storedConfigs.concat(uiConfigs));
  304. },
  305. loadGlobals: function () {
  306. var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
  307. this.set('globalProperties', globals);
  308. this.loadStaticGlobal(); //Hack for properties which are declared in config_properties.js and not able to retrieve values declared in secure_properties.js
  309. this.loadUsersToGlobal();
  310. this.loadHostNamesToGlobal();
  311. this.loadPrimaryNamesToGlobals();
  312. },
  313. loadUsersToGlobal: function () {
  314. if (!this.get('serviceUsers').length) {
  315. this.loadUsersFromServer();
  316. }
  317. App.router.get('mainAdminSecurityController.serviceUsers').forEach(function (_user) {
  318. this.get('globalProperties').pushObject(_user);
  319. }, this);
  320. },
  321. loadHostNamesToGlobal: function () {
  322. var oozieHostComponent = App.Service.find('OOZIE').get('hostComponents').findProperty('componentName', 'OOZIE_SERVER');
  323. if (this.get('isOozieSelected') && oozieHostComponent) {
  324. var oozieHostName = oozieHostComponent.get('host.hostName');
  325. this.get('globalProperties').pushObject({
  326. id: 'puppet var',
  327. name: 'oozieserver_host',
  328. value: oozieHostName
  329. });
  330. }
  331. var hiveHostComponent = App.Service.find('HIVE').get('hostComponents').findProperty('componentName', 'HIVE_METASTORE');
  332. if (this.get('isHiveSelected') && hiveHostComponent) {
  333. var hiveHostName = hiveHostComponent.get('host.hostName');
  334. this.get('globalProperties').pushObject({
  335. id: 'puppet var',
  336. name: 'hivemetastore_host',
  337. value: hiveHostName
  338. });
  339. }
  340. },
  341. loadStaticGlobal: function () {
  342. var globalProperties = this.get('globalProperties');
  343. this.get('globalProperties').forEach(function (_property) {
  344. switch (_property.name) {
  345. case 'security_enabled':
  346. _property.value = 'true';
  347. break;
  348. case 'dfs_datanode_address':
  349. _property.value = '1019';
  350. break;
  351. case 'dfs_datanode_http_address':
  352. _property.value = '1022';
  353. break;
  354. }
  355. }, this);
  356. },
  357. loadPrimaryNamesToGlobals: function () {
  358. var principalProperties = this.getPrincipalNames();
  359. principalProperties.forEach(function (_principalProperty) {
  360. var name = _principalProperty.name.replace('principal', 'primary');
  361. var value = _principalProperty.value.split('/')[0];
  362. this.get('globalProperties').pushObject({name: name, value: value});
  363. }, this);
  364. },
  365. getPrincipalNames: function () {
  366. var principalNames = [];
  367. var allPrincipalNames = [];
  368. this.get('globalProperties').forEach(function (_globalProperty) {
  369. if (/principal_name?$/.test(_globalProperty.name)) {
  370. principalNames.pushObject(_globalProperty);
  371. }
  372. }, this);
  373. this.get('secureProperties').forEach(function (_secureProperty) {
  374. if (/principal_name?$/.test(_secureProperty.name)) {
  375. var principalName = principalNames.findProperty('name', _secureProperty.name);
  376. if (!principalName) {
  377. _secureProperty.value = _secureProperty.defaultValue;
  378. principalNames.pushObject(_secureProperty);
  379. }
  380. }
  381. }, this);
  382. return principalNames;
  383. },
  384. loadUsersFromServer: function () {
  385. if (App.testMode) {
  386. var serviceUsers = this.get('serviceUsers');
  387. serviceUsers.pushObject({id: 'puppet var', name: 'hdfs_user', value: 'hdfs'});
  388. serviceUsers.pushObject({id: 'puppet var', name: 'mapred_user', value: 'mapred'});
  389. serviceUsers.pushObject({id: 'puppet var', name: 'hbase_user', value: 'hbase'});
  390. serviceUsers.pushObject({id: 'puppet var', name: 'hive_user', value: 'hive'});
  391. } else {
  392. App.router.get('mainAdminSecurityController').setSecurityStatus();
  393. }
  394. },
  395. loadClusterConfigs: function () {
  396. var self = this;
  397. var url = App.apiPrefix + '/clusters/' + App.router.getClusterName();
  398. App.ajax.send({
  399. name: 'admin.security.add.cluster_configs',
  400. sender: this,
  401. success: 'loadClusterConfigsSuccessCallback',
  402. error: 'loadClusterConfigsErrorCallback'
  403. });
  404. },
  405. loadClusterConfigsSuccessCallback: function (data) {
  406. var self = this;
  407. //prepare tags to fetch all configuration for a service
  408. this.get('content.services').forEach(function (_secureService) {
  409. self.setServiceTagNames(_secureService, data.Clusters.desired_configs);
  410. });
  411. this.getAllConfigurations();
  412. },
  413. loadClusterConfigsErrorCallback: function (request, ajaxOptions, error) {
  414. this.get('stages').findProperty('stage', 'stage3').set('isError', true);
  415. console.log("TRACE: error code status is: " + request.status);
  416. },
  417. /**
  418. * set tagnames for configuration of the *-site.xml
  419. */
  420. setServiceTagNames: function (secureService, configs) {
  421. //var serviceConfigTags = this.get('serviceConfigTags');
  422. for (var index in configs) {
  423. if (secureService.sites && secureService.sites.contains(index)) {
  424. var serviceConfigObj = {
  425. siteName: index,
  426. tagName: configs[index].tag,
  427. newTagName: null,
  428. configs: {}
  429. };
  430. console.log("The value of serviceConfigTags[index]: " + configs[index]);
  431. this.get('serviceConfigTags').pushObject(serviceConfigObj);
  432. }
  433. }
  434. return serviceConfigObj;
  435. },
  436. applyConfigurationsToCluster: function () {
  437. this.set('noOfWaitingAjaxCalls', this.get('serviceConfigTags').length);
  438. this.get('serviceConfigTags').forEach(function (_serviceConfig) {
  439. this.applyConfigurationToCluster({type: _serviceConfig.siteName, tag: _serviceConfig.newTagName, properties: _serviceConfig.configs});
  440. }, this);
  441. },
  442. applyConfigurationToCluster: function (data) {
  443. var clusterData = {
  444. Clusters: {
  445. desired_config: data
  446. }
  447. };
  448. App.ajax.send({
  449. name: 'admin.security.apply_configuration',
  450. sender: this,
  451. data: {
  452. clusterData: clusterData
  453. },
  454. success: 'applyConfigurationToClusterSuccessCallback',
  455. error: 'applyConfigurationToClusterErrorCallback'
  456. });
  457. },
  458. applyConfigurationToClusterSuccessCallback: function (data) {
  459. this.set('noOfWaitingAjaxCalls', this.get('noOfWaitingAjaxCalls') - 1);
  460. if (this.get('noOfWaitingAjaxCalls') == 0) {
  461. var currentStage = this.get('stages').findProperty('stage', 'stage3');
  462. currentStage.set('isSuccess', true);
  463. }
  464. },
  465. applyConfigurationToClusterErrorCallback: function (request, ajaxOptions, error) {
  466. this.get('stages').findProperty('stage', 'stage3').set('isError', true);
  467. },
  468. /**
  469. * gets site config properties from server and sets it for every configuration
  470. * @param serviceConfigTags
  471. */
  472. getAllConfigurations: function () {
  473. var urlParams = [];
  474. this.get('serviceConfigTags').forEach(function (_tag) {
  475. urlParams.push('(type=' + _tag.siteName + '&tag=' + _tag.tagName + ')');
  476. }, this);
  477. if (urlParams.length > 0) {
  478. App.ajax.send({
  479. name: 'admin.security.all_configurations',
  480. sender: this,
  481. data: {
  482. urlParams: urlParams.join('|')
  483. },
  484. success: 'getAllConfigurationsSuccessCallback',
  485. error: 'getAllConfigurationsErrorCallback'
  486. });
  487. }
  488. },
  489. getAllConfigurationsSuccessCallback: function (data) {
  490. console.log("TRACE: In success function for the GET getServiceConfigsFromServer call");
  491. this.get('serviceConfigTags').forEach(function (_tag) {
  492. if (!data.items.someProperty('type', _tag.siteName)) {
  493. console.log("Error: Metadata for secure services (secure_configs.js) is having config tags that are not being retrieved from server");
  494. this.get('stages').findProperty('stage', 'stage3').set('isError', true);
  495. }
  496. _tag.configs = data.items.findProperty('type', _tag.siteName).properties;
  497. }, this);
  498. this.addSecureConfigs();
  499. this.applyConfigurationsToCluster();
  500. },
  501. getAllConfigurationsErrorCallback: function (request, ajaxOptions, error) {
  502. this.get('stages').findProperty('stage', 'stage3').set('isError', true);
  503. console.log("TRACE: In error function for the getServiceConfigsFromServer call");
  504. console.log("TRACE: error code status is: " + request.status);
  505. },
  506. addSecureConfigs: function () {
  507. this.get('serviceConfigTags').forEach(function (_serviceConfigTags) {
  508. _serviceConfigTags.newTagName = 'version' + (new Date).getTime();
  509. if (_serviceConfigTags.siteName === 'global') {
  510. var realmName = this.get('globalProperties').findProperty('name', 'kerberos_domain');
  511. if (this.get('isNagiosSelected')) {
  512. var nagiosPrincipalName = this.get('globalProperties').findProperty('name', 'nagios_principal_name');
  513. nagiosPrincipalName.value = nagiosPrincipalName.value + '@' + realmName.value;
  514. }
  515. if (this.get('isZkSelected')) {
  516. var zkPrincipalName = this.get('globalProperties').findProperty('name', 'zookeeper_principal_name');
  517. zkPrincipalName.value = zkPrincipalName.value + '@' + realmName.value;
  518. }
  519. this.get('globalProperties').forEach(function (_globalProperty) {
  520. _serviceConfigTags.configs[_globalProperty.name] = _globalProperty.value;
  521. }, this);
  522. }
  523. else {
  524. this.get('configs').filterProperty('id', 'site property').filterProperty('filename', _serviceConfigTags.siteName + '.xml').forEach(function (_config) {
  525. _serviceConfigTags.configs[_config.name] = _config.value;
  526. }, this);
  527. }
  528. }, this);
  529. },
  530. saveStages: function () {
  531. var stages = [];
  532. this.get('stages').forEach(function (_stage) {
  533. var stage = {
  534. name: _stage.get('name'),
  535. stage: _stage.get('stage'),
  536. label: _stage.get('label'),
  537. isPolling: _stage.get('isPolling'),
  538. isStarted: _stage.get('isStarted'),
  539. requestId: _stage.get('requestId'),
  540. isSuccess: _stage.get('isSuccess'),
  541. isError: _stage.get('isError'),
  542. url: _stage.get('url'),
  543. polledData: _stage.get('polledData'),
  544. data: _stage.get('data')
  545. };
  546. stages.pushObject(stage);
  547. }, this);
  548. App.db.setSecurityDeployStages(stages);
  549. App.clusterStatus.setClusterStatus({
  550. clusterName: this.get('clusterName'),
  551. clusterState: 'ADD_SECURITY_STEP_4',
  552. wizardControllerName: App.router.get('addSecurityController.name'),
  553. localdb: App.db.data
  554. });
  555. }.observes('stages.@each.requestId', 'stages.@each.isStarted', 'stages.@each.isCompleted')
  556. });