step8_controller.js 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747
  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. var stringUtils = require('utils/string_utils');
  20. App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
  21. name: 'wizardStep8Controller',
  22. /**
  23. * List of raw data about cluster that should be displayed
  24. * @type {Array}
  25. */
  26. rawContent: [
  27. {
  28. config_name: 'Admin',
  29. display_name: 'Admin Name',
  30. config_value: ''
  31. },
  32. {
  33. config_name: 'cluster',
  34. display_name: 'Cluster Name',
  35. config_value: ''
  36. },
  37. {
  38. config_name: 'hosts',
  39. display_name: 'Total Hosts',
  40. config_value: ''
  41. },
  42. {
  43. config_name: 'Repo',
  44. display_name: 'Local Repository',
  45. config_value: ''
  46. }
  47. ],
  48. /**
  49. * List of data about cluster (based on formatted <code>rawContent</code>)
  50. * @type {Object[]}
  51. */
  52. clusterInfo: [],
  53. /**
  54. * List of services with components assigned to hosts
  55. * @type {Object[]}
  56. */
  57. services: [],
  58. /**
  59. * @type {Object[]}
  60. */
  61. configs: [],
  62. /**
  63. * All configs
  64. * @type {Array}
  65. */
  66. configMapping: function () {
  67. return App.config.get('configMapping').all(true);
  68. }.property('App.config.configMapping'),
  69. /**
  70. *
  71. */
  72. slaveComponentConfig: null,
  73. /**
  74. * Should Submit button be disabled
  75. * @type {bool}
  76. */
  77. isSubmitDisabled: false,
  78. /**
  79. * Should Back button be disabled
  80. * @type {bool}
  81. */
  82. isBackBtnDisabled: false,
  83. /**
  84. * Is error appears while <code>ajaxQueue</code> executes
  85. * @type {bool}
  86. */
  87. hasErrorOccurred: false,
  88. /**
  89. * Are services installed
  90. * Used to hide Deploy Progress Bar
  91. * @type {bool}
  92. */
  93. servicesInstalled: false,
  94. /**
  95. * List of service config tags
  96. * @type {Object[]}
  97. */
  98. serviceConfigTags: [],
  99. /**
  100. * Ajax-requests queue
  101. * @type {App.ajaxQueue}
  102. */
  103. ajaxRequestsQueue: null,
  104. /**
  105. * Is cluster security enabled
  106. * @type {bool}
  107. */
  108. securityEnabled: function () {
  109. return App.router.get('mainAdminSecurityController.securityEnabled');
  110. }.property('App.router.mainAdminSecurityController.securityEnabled'),
  111. /**
  112. * Selected config group
  113. * @type {Object}
  114. */
  115. selectedConfigGroup: null,
  116. /**
  117. * List of config groups
  118. * @type {Object[]}
  119. */
  120. configGroups: [],
  121. /**
  122. * List of selected but not installed services
  123. * @type {Object[]}
  124. */
  125. selectedServices: function () {
  126. return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false);
  127. }.property('content.services').cacheable(),
  128. /**
  129. * List of installed and selected services
  130. * @type {Object[]}
  131. */
  132. installedServices: function () {
  133. return this.get('content.services').filterProperty('isSelected').filterProperty('isInstalled');
  134. }.property('content.services').cacheable(),
  135. /**
  136. * Ajax-requests count
  137. * @type {number}
  138. */
  139. ajaxQueueLength: 0,
  140. /**
  141. * Current cluster name
  142. * @type {string}
  143. */
  144. clusterName: function () {
  145. return this.get('content.cluster.name');
  146. }.property('content.cluster.name'),
  147. /**
  148. * List of existing cluster names
  149. * @type {string[]}
  150. */
  151. clusterNames: [],
  152. /**
  153. * Clear current step data
  154. * @method clearStep
  155. */
  156. clearStep: function () {
  157. this.get('services').clear();
  158. this.get('configs').clear();
  159. this.get('clusterInfo').clear();
  160. this.get('serviceConfigTags').clear();
  161. this.set('servicesInstalled', false);
  162. this.set('ajaxQueueLength', 0);
  163. this.set('ajaxRequestsQueue', App.ajaxQueue.create());
  164. this.set('ajaxRequestsQueue.finishedCallback', this.ajaxQueueFinished);
  165. },
  166. /**
  167. * Load current step data
  168. * @method loadStep
  169. */
  170. loadStep: function () {
  171. console.log("TRACE: Loading step8: Review Page");
  172. this.clearStep();
  173. if (this.get('content.serviceConfigProperties')) {
  174. this.formatProperties();
  175. this.loadConfigs();
  176. if (this.get('content.controllerName') != 'installerController' && this.get('securityEnabled')) {
  177. this.prepareSecureConfigs();
  178. this.get('content.services').filterProperty('isSelected', true)
  179. .mapProperty('serviceName').forEach(function(serviceName){
  180. var config = this.get('secureConfigs').findProperty('serviceName', serviceName);
  181. if (config) {
  182. this.setPrincipalValue(serviceName, config.name);
  183. }
  184. }, this);
  185. }
  186. }
  187. this.loadClusterInfo();
  188. this.loadServices();
  189. this.set('isSubmitDisabled', false);
  190. this.set('isBackBtnDisabled', false);
  191. },
  192. /**
  193. * replace whitespace character with coma between directories
  194. * @method formatProperties
  195. */
  196. formatProperties: function () {
  197. this.get('content.serviceConfigProperties').forEach(function (_configProperty) {
  198. _configProperty.value = App.config.trimProperty(_configProperty, false);
  199. });
  200. },
  201. /**
  202. * Remove unused Hive configs
  203. * @param {Ember.Enumerable} configs
  204. * @returns {Ember.Enumerable}
  205. * @method removeHiveConfigs
  206. */
  207. removeHiveConfigs: function (configs) {
  208. var hiveDb = configs.findProperty('name', 'hive_database');
  209. var hiveDbType = configs.findProperty('name', 'hive_database_type');
  210. if (hiveDbType) {
  211. var hive_properties = Em.A([]);
  212. switch (hiveDb.value) {
  213. case 'New MySQL Database':
  214. if (configs.someProperty('name', 'hive_ambari_host')) {
  215. configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_ambari_host').value;
  216. hiveDbType.value = 'mysql';
  217. }
  218. hive_properties = Em.A(['hive_existing_mysql_host', 'hive_existing_mysql_database', 'hive_existing_oracle_host',
  219. 'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
  220. break;
  221. case 'Existing MySQL Database':
  222. configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_existing_mysql_host').value;
  223. hiveDbType.value = 'mysql';
  224. hive_properties = Em.A(['hive_ambari_host', 'hive_ambari_database', 'hive_existing_oracle_host',
  225. 'hive_existing_oracle_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
  226. break;
  227. case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
  228. configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_existing_postgresql_host').value;
  229. hiveDbType.value = 'postgres';
  230. hive_properties = Em.A(['hive_ambari_host', 'hive_ambari_database', 'hive_existing_oracle_host',
  231. 'hive_existing_oracle_database', 'hive_existing_mysql_host', 'hive_existing_mysql_database']);
  232. break;
  233. default:
  234. configs.findProperty('name', 'hive_hostname').value = configs.findProperty('name', 'hive_existing_oracle_host').value;
  235. hiveDbType.value = 'oracle';
  236. hive_properties = Em.A(['hive_ambari_host', 'hive_ambari_database', 'hive_existing_mysql_host',
  237. 'hive_existing_mysql_database', 'hive_existing_postgresql_host', 'hive_existing_postgresql_database']);
  238. break;
  239. }
  240. hive_properties.forEach(function (property) {
  241. configs = configs.without(configs.findProperty('name', property));
  242. });
  243. }
  244. return configs;
  245. },
  246. /**
  247. * Remove unused Oozie configs
  248. * @param {Ember.Enumerable} configs
  249. * @returns {Ember.Enumerable}
  250. * @method removeOozieConfigs
  251. */
  252. removeOozieConfigs: function (configs) {
  253. var oozieDb = configs.findProperty('name', 'oozie_database');
  254. var oozieDbType = configs.findProperty('name', 'hive_database_type');
  255. if (oozieDbType) {
  256. var oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database']);
  257. switch (oozieDb.value) {
  258. case 'New Derby Database':
  259. configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_ambari_host').value;
  260. oozieDbType.value = 'derby';
  261. oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_mysql_host',
  262. 'oozie_existing_mysql_database', 'oozie_existing_oracle_host', 'oozie_existing_oracle_database',
  263. 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
  264. break;
  265. case 'Existing MySQL Database':
  266. configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_existing_mysql_host').value;
  267. oozieDbType.value = 'mysql';
  268. oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_oracle_host',
  269. 'oozie_existing_oracle_database', 'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
  270. break;
  271. case Em.I18n.t('services.service.config.hive.oozie.postgresql'):
  272. configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_existing_postgresql_host').value;
  273. oozieDbType.value = 'postgresql';
  274. oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_oracle_host',
  275. 'oozie_existing_oracle_database', 'oozie_existing_mysql_host', 'oozie_existing_mysql_database']);
  276. break;
  277. default:
  278. configs.findProperty('name', 'oozie_hostname').value = configs.findProperty('name', 'oozie_existing_oracle_host').value;
  279. oozieDbType.value = 'oracle';
  280. oozie_properties = Em.A(['oozie_ambari_host', 'oozie_ambari_database', 'oozie_existing_mysql_host',
  281. 'oozie_existing_mysql_database', 'oozie_derby_database', 'oozie_existing_postgresql_host', 'oozie_existing_postgresql_database']);
  282. break;
  283. }
  284. oozie_properties.forEach(function (property) {
  285. configs = configs.without(configs.findProperty('name', property));
  286. });
  287. }
  288. return configs;
  289. },
  290. /**
  291. * Load all site properties
  292. * @method loadConfigs
  293. */
  294. loadConfigs: function () {
  295. //storedConfigs contains custom configs as well
  296. var configs = this.get('content.serviceConfigProperties');
  297. if (configs.someProperty('name', 'hive_database')) {
  298. configs = this.removeHiveConfigs(configs);
  299. }
  300. if (configs.someProperty('name', 'oozie_database')) {
  301. configs = this.removeOozieConfigs(configs);
  302. }
  303. configs.forEach(function (_config) {
  304. _config.value = (typeof _config.value === "boolean") ? _config.value.toString() : _config.value;
  305. });
  306. var mappedConfigs = App.config.excludeUnsupportedConfigs(this.get('configMapping'), this.get('selectedServices').mapProperty('serviceName'));
  307. var uiConfigs = this.loadUiSideConfigs(mappedConfigs);
  308. var customGroupConfigs = [];
  309. var allConfigs = configs.concat(uiConfigs).filter(function (config) {
  310. if (config.group) {
  311. customGroupConfigs.push(config);
  312. return false;
  313. } else {
  314. return true;
  315. }
  316. });
  317. this.set('customNonDefaultGroupConfigs', customGroupConfigs);
  318. this.set('configs', allConfigs);
  319. },
  320. /**
  321. * Load UI configs
  322. * @param {Array} configMapping
  323. * @return {Array}
  324. * @method loadUiSideConfigs
  325. */
  326. loadUiSideConfigs: function (configMapping) {
  327. var uiConfig = [];
  328. var configs = configMapping.filterProperty('foreignKey', null);
  329. this.addDynamicProperties(configs);
  330. configs.forEach(function (_config) {
  331. var valueWithOverrides = this.getGlobConfigValueWithOverrides(_config.templateName, _config.value, _config.name);
  332. uiConfig.pushObject({
  333. "id": "site property",
  334. "name": _config.name,
  335. "value": valueWithOverrides.value,
  336. "filename": _config.filename,
  337. "overrides": valueWithOverrides.overrides
  338. });
  339. }, this);
  340. var dependentConfig = $.extend(true, [], configMapping.filterProperty('foreignKey'));
  341. dependentConfig.forEach(function (_config) {
  342. App.config.setConfigValue(uiConfig, this.get('content.serviceConfigProperties'), _config);
  343. uiConfig.pushObject({
  344. "id": "site property",
  345. "name": _config._name || _config.name,
  346. "value": _config.value,
  347. "filename": _config.filename
  348. });
  349. }, this);
  350. return uiConfig;
  351. },
  352. /**
  353. * Add dynamic properties to configs
  354. * @param {Array} configs
  355. * @method addDynamicProperties
  356. */
  357. addDynamicProperties: function (configs) {
  358. var templetonHiveProperty = this.get('content.serviceConfigProperties').someProperty('name', 'templeton.hive.properties');
  359. if (!templetonHiveProperty) {
  360. configs.pushObject({
  361. "name": "templeton.hive.properties",
  362. "templateName": ["hivemetastore_host"],
  363. "foreignKey": null,
  364. "value": "hive.metastore.local=false,hive.metastore.uris=thrift://<templateName[0]>:9083,hive.metastore.sasl.enabled=yes,hive.metastore.execute.setugi=true,hive.metastore.warehouse.dir=/apps/hive/warehouse",
  365. "filename": "webhcat-site.xml"
  366. });
  367. }
  368. },
  369. /**
  370. * Format <code>content.hosts</code> from Object to Array
  371. * @returns {Array}
  372. * @method getRegisteredHosts
  373. */
  374. getRegisteredHosts: function () {
  375. var allHosts = this.get('content.hosts');
  376. var hosts = [];
  377. for (var hostName in allHosts) {
  378. if (allHosts.hasOwnProperty(hostName)) {
  379. if (allHosts[hostName].bootStatus == 'REGISTERED') {
  380. allHosts[hostName].hostName = allHosts[hostName].name;
  381. hosts.pushObject(allHosts[hostName]);
  382. }
  383. }
  384. }
  385. return hosts;
  386. },
  387. /**
  388. * Set all site property that are derived from other puppet-variable
  389. * @param {String} templateName
  390. * @param {String} expression
  391. * @param {String} name
  392. * @return {Object}
  393. * example: <code>{
  394. * value: '...',
  395. * overrides: [
  396. * {
  397. * value: 'v1',
  398. * hosts: ['h1', 'h2']
  399. * },
  400. * {
  401. * value: 'v2',
  402. * hosts: ['h2', 'h3']
  403. * },
  404. * ....
  405. * ]
  406. * }</code>
  407. * @method getGlobConfigValueWithOverrides
  408. */
  409. getGlobConfigValueWithOverrides: function (templateName, expression, name) {
  410. var express = expression.match(/<(.*?)>/g);
  411. var value = expression;
  412. if (express == null) {
  413. return { value: expression, overrides: []}; // if site property do not map any global property then return the value
  414. }
  415. var overrideHostToValue = {};
  416. express.forEach(function (_express) {
  417. //console.log("The value of template is: " + _express);
  418. var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
  419. if (this.get('configs').someProperty('name', templateName[index])) {
  420. //console.log("The name of the variable is: " + this.get('content.serviceConfigProperties').findProperty('name', templateName[index]).name);
  421. var globalObj = this.get('configs').findProperty('name', templateName[index]);
  422. var globValue = globalObj.value;
  423. // Hack for templeton.zookeeper.hosts
  424. var preReplaceValue = null;
  425. 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
  426. preReplaceValue = value;
  427. value = this._replaceConfigValues(name, _express, value, globValue);
  428. }
  429. if (globalObj.overrides != null) {
  430. globalObj.overrides.forEach(function (override) {
  431. var ov = override.value;
  432. var hostsArray = override.hosts;
  433. hostsArray.forEach(function (host) {
  434. if (!(host in overrideHostToValue)) {
  435. overrideHostToValue[host] = this._replaceConfigValues(name, _express, preReplaceValue, ov);
  436. } else {
  437. overrideHostToValue[host] = this._replaceConfigValues(name, _express, overrideHostToValue[host], ov);
  438. }
  439. }, this);
  440. }, this);
  441. }
  442. } else {
  443. /*
  444. console.log("ERROR: The variable name is: " + templateName[index]);
  445. console.log("ERROR: mapped config from configMapping file has no corresponding variable in " +
  446. "content.serviceConfigProperties. Two possible reasons for the error could be: 1) The service is not selected. " +
  447. "and/OR 2) The service_config metadata file has no corresponding global var for the site property variable");
  448. */
  449. value = null;
  450. }
  451. }, this);
  452. var valueWithOverrides = {
  453. value: value,
  454. overrides: []
  455. };
  456. var overrideValueToHostMap = {};
  457. if (!jQuery.isEmptyObject(overrideHostToValue)) {
  458. for (var host in overrideHostToValue) {
  459. var hostVal = overrideHostToValue[host];
  460. if (!(hostVal in overrideValueToHostMap)) {
  461. overrideValueToHostMap[hostVal] = [];
  462. }
  463. overrideValueToHostMap[hostVal].push(host);
  464. }
  465. }
  466. for (var val in overrideValueToHostMap) {
  467. valueWithOverrides.overrides.push({
  468. value: val,
  469. hosts: overrideValueToHostMap[val]
  470. });
  471. }
  472. return valueWithOverrides;
  473. },
  474. /**
  475. * replace some values in config property
  476. * @param {string} name
  477. * @param {string} express
  478. * @param {string} value
  479. * @param {string} globValue
  480. * @return {string}
  481. * @private
  482. * @method _replaceConfigValues
  483. */
  484. _replaceConfigValues: function (name, express, value, globValue) {
  485. return value.replace(express, globValue);
  486. },
  487. /**
  488. * Load all info about cluster to <code>clusterInfo</code> variable
  489. * @method loadClusterInfo
  490. */
  491. loadClusterInfo: function () {
  492. //Admin name
  493. var admin = this.rawContent.findProperty('config_name', 'Admin');
  494. admin.config_value = App.db.getLoginName();
  495. console.log("STEP8: the value of content cluster name: " + App.db.getLoginName());
  496. if (admin.config_value) {
  497. this.get('clusterInfo').pushObject(Ember.Object.create(admin));
  498. }
  499. // cluster name
  500. var cluster = this.rawContent.findProperty('config_name', 'cluster');
  501. cluster.config_value = this.get('content.cluster.name');
  502. console.log("STEP8: the value of content cluster name: " + this.get('content.cluster.name'));
  503. this.get('clusterInfo').pushObject(Ember.Object.create(cluster));
  504. //hosts
  505. var newHostsCount = 0;
  506. var totalHostsCount = 0;
  507. var hosts = this.get('content.hosts');
  508. for (var hostName in hosts) {
  509. newHostsCount += ~~(!hosts[hostName].isInstalled);
  510. totalHostsCount++;
  511. }
  512. var totalHostsObj = this.rawContent.findProperty('config_name', 'hosts');
  513. totalHostsObj.config_value = totalHostsCount + ' (' + newHostsCount + ' new)';
  514. this.get('clusterInfo').pushObject(Em.Object.create(totalHostsObj));
  515. //repo
  516. if (['addHostController', 'addServiceController'].contains(this.get('content.controllerName'))) {
  517. this.loadRepoInfo();
  518. } else {
  519. // from install wizard
  520. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  521. var allRepos = [];
  522. if (selectedStack && selectedStack.operatingSystems) {
  523. selectedStack.operatingSystems.forEach(function (os) {
  524. if (os.selected) {
  525. allRepos.push(Em.Object.create({
  526. base_url: os.baseUrl,
  527. os_type: os.osType,
  528. repo_id: os.repoId
  529. }));
  530. }
  531. }, this);
  532. }
  533. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  534. this.get('clusterInfo').set('repoInfo', allRepos);
  535. }
  536. },
  537. /**
  538. * Load repo info for add Service/Host wizard review page
  539. * @return {$.ajax|null}
  540. * @method loadRepoInfo
  541. */
  542. loadRepoInfo: function () {
  543. var nameVersionCombo = App.get('currentStackVersion').split('-');
  544. return App.ajax.send({
  545. name: 'cluster.load_repositories',
  546. sender: this,
  547. data: {
  548. stackName: nameVersionCombo[0],
  549. stackVersion: nameVersionCombo[1]
  550. },
  551. success: 'loadRepoInfoSuccessCallback',
  552. error: 'loadRepoInfoErrorCallback'
  553. });
  554. },
  555. /**
  556. * Save all repo base URL of all OS type to <code>repoInfo<code>
  557. * @param {object} data
  558. * @method loadRepoInfoSuccessCallback
  559. */
  560. loadRepoInfoSuccessCallback: function (data) {
  561. var allRepos = [];
  562. data.items.forEach(function (os) {
  563. if (!App.get('supports.ubuntu') && os.OperatingSystems.os_type == 'debian12') return; // @todo: remove after Ubuntu support confirmation
  564. os.repositories.forEach(function (repository) {
  565. allRepos.push(Em.Object.create({
  566. base_url: repository.Repositories.base_url,
  567. os_type: repository.Repositories.os_type,
  568. repo_id: repository.Repositories.repo_id
  569. }));
  570. });
  571. }, this);
  572. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  573. this.get('clusterInfo').set('repoInfo', allRepos);
  574. },
  575. /**
  576. * @param {object} request
  577. * @method loadRepoInfoErrorCallback
  578. */
  579. loadRepoInfoErrorCallback: function (request) {
  580. console.log('Error message is: ' + request.responseText);
  581. var allRepos = [];
  582. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  583. this.get('clusterInfo').set('repoInfo', allRepos);
  584. },
  585. /**
  586. * Load all info about services to <code>services</code> variable
  587. * @method loadServices
  588. */
  589. loadServices: function () {
  590. this.get('selectedServices').filterProperty('isHiddenOnSelectServicePage', false).forEach(function (service) {
  591. console.log('INFO: step8: Name of the service from getService function: ' + service.get('serviceName'));
  592. var serviceObj = Em.Object.create({
  593. service_name: service.get('serviceName'),
  594. display_name: service.get('displayNameOnSelectServicePage'),
  595. service_components: Em.A([])
  596. });
  597. service.get('serviceComponents').forEach(function (component) {
  598. // show clients for services that have only clients components
  599. if ((component.get('isClient') || component.get('isClientBehavior')) && !service.get('isClientOnlyService')) return;
  600. // skip components that was hide on assign master page
  601. if (component.get('isMaster') && !component.get('isShownOnInstallerAssignMasterPage')) return;
  602. // no HA component
  603. if (App.get('isHaEnabled') && component.get('isHAComponentOnly')) return;
  604. var displayName;
  605. if (component.get('isClient')) {
  606. displayName = Em.I18n.t('common.clients')
  607. } else {
  608. // remove service name from component display name
  609. displayName = component.get('displayName').replace(new RegExp('^' + service.get('serviceName') + '\\s', 'i'), '');
  610. }
  611. serviceObj.get('service_components').pushObject(Em.Object.create({
  612. component_name: component.get('isClient') ? Em.I18n.t('common.client').toUpperCase() : component.get('componentName'),
  613. display_name: displayName,
  614. component_value: this.assignComponentHosts(component)
  615. }));
  616. }, this);
  617. if (service.get('customReviewHandler')) {
  618. for (var displayName in service.get('customReviewHandler')) {
  619. serviceObj.get('service_components').pushObject(Em.Object.create({
  620. display_name: displayName,
  621. component_value: this.assignComponentHosts(Em.Object.create({
  622. customHandler: service.get('customReviewHandler.' + displayName)
  623. }))
  624. }));
  625. }
  626. }
  627. this.get('services').pushObject(serviceObj);
  628. }, this);
  629. },
  630. /**
  631. * Set <code>component_value</code> property to <code>component</code>
  632. * @param {Em.Object} component
  633. * @return {String}
  634. * @method assignComponentHosts
  635. */
  636. assignComponentHosts: function (component) {
  637. var componentValue;
  638. if (component.get('customHandler')) {
  639. componentValue = this[component.get('customHandler')].call(this, component);
  640. }
  641. else {
  642. if (component.get('isMaster')) {
  643. componentValue = this.getMasterComponentValue(component.get('componentName'));
  644. }
  645. else {
  646. console.log(' --- ---INFO: step8: NOT component isMaster');
  647. var hostsLength = this.get('content.slaveComponentHosts')
  648. .findProperty('componentName', component.get('isClient') ? Em.I18n.t('common.client').toUpperCase() : component.get('componentName'))
  649. .hosts.length;
  650. componentValue = hostsLength + Em.I18n.t('installer.step8.host' + ((hostsLength > 1) ? 's' : ''));
  651. }
  652. }
  653. return componentValue;
  654. },
  655. getMasterComponentValue: function (componentName) {
  656. var masterComponents = this.get('content.masterComponentHosts');
  657. var hostsCount = masterComponents.filterProperty('component', componentName).length;
  658. return stringUtils.pluralize(hostsCount,
  659. masterComponents.findProperty('component', componentName).hostName,
  660. hostsCount + ' ' + Em.I18n.t('installer.step8.hosts'));
  661. },
  662. /**
  663. * Set dispalyed Hive DB value based on DB type
  664. * @param {Ember.Object} dbComponent
  665. * @method loadHiveDbValue
  666. */
  667. loadHiveDbValue: function () {
  668. var db,
  669. serviceConfigPreoprties = this.get('wizardController').getDBProperty('serviceConfigProperties'),
  670. hiveDb = serviceConfigPreoprties.findProperty('name', 'hive_database');
  671. if (hiveDb.value === 'New MySQL Database') {
  672. return 'MySQL (New Database)';
  673. }
  674. else {
  675. if (hiveDb.value === 'Existing MySQL Database') {
  676. db = serviceConfigPreoprties.findProperty('name', 'hive_existing_mysql_database');
  677. return db.value + ' (' + hiveDb.value + ')';
  678. }
  679. else {
  680. if (hiveDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql')) {
  681. db = serviceConfigPreoprties.findProperty('name', 'hive_existing_postgresql_database');
  682. return db.value + ' (' + hiveDb.value + ')';
  683. }
  684. else { // existing oracle database
  685. db = serviceConfigPreoprties.findProperty('name', 'hive_existing_oracle_database');
  686. return db.value + ' (' + hiveDb.value + ')';
  687. }
  688. }
  689. }
  690. },
  691. /**
  692. * Set displayed HBase master value
  693. * @param {Object} hbaseMaster
  694. * @method loadHbaseMasterValue
  695. */
  696. loadHbaseMasterValue: function (hbaseMaster) {
  697. var hbaseHostName = this.get('content.masterComponentHosts').filterProperty('component', hbaseMaster.component_name);
  698. if (hbaseHostName.length == 1) {
  699. hbaseMaster.set('component_value', hbaseHostName[0].hostName);
  700. } else {
  701. hbaseMaster.set('component_value', hbaseHostName[0].hostName + " " + Em.I18n.t('installer.step8.other').format(hbaseHostName.length - 1));
  702. }
  703. },
  704. /**
  705. * Set displayed ZooKeeper Server value
  706. * @param {Object} serverComponent
  707. * @method loadZkServerValue
  708. */
  709. loadZkServerValue: function (serverComponent) {
  710. var zkHostNames = this.get('content.masterComponentHosts').filterProperty('component', serverComponent.component_name).length;
  711. var hostSuffix;
  712. if (zkHostNames === 1) {
  713. hostSuffix = Em.I18n.t('installer.step8.host');
  714. } else {
  715. hostSuffix = Em.I18n.t('installer.step8.hosts');
  716. }
  717. serverComponent.set('component_value', zkHostNames + hostSuffix);
  718. },
  719. /**
  720. * Set displayed Oozie DB value based on DB type
  721. * @param {Object} dbComponent
  722. * @method loadOozieDbValue
  723. */
  724. loadOozieDbValue: function () {
  725. var db, oozieDb = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_database');
  726. if (oozieDb.value === 'New Derby Database') {
  727. db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_derby_database');
  728. return db.value + ' (' + oozieDb.value + ')';
  729. }
  730. else {
  731. if (oozieDb.value === 'Existing MySQL Database') {
  732. db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_mysql_database');
  733. return db.value + ' (' + oozieDb.value + ')';
  734. }
  735. else {
  736. if (oozieDb.value === Em.I18n.t('services.service.config.hive.oozie.postgresql')) {
  737. db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_postgresql_database');
  738. return db.value + ' (' + oozieDb.value + ')';
  739. }
  740. else { // existing oracle database
  741. db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_oracle_database');
  742. return db.value + ' (' + oozieDb.value + ')';
  743. }
  744. }
  745. }
  746. },
  747. /**
  748. * Set displayed Nagion Admin value
  749. * @param {Object} nagiosAdmin
  750. * @method loadNagiosAdminValue
  751. */
  752. loadNagiosAdminValue: function () {
  753. var config = this.get('content.serviceConfigProperties');
  754. var adminLoginName = config.findProperty('name', 'nagios_web_login');
  755. var adminEmail = config.findProperty('name', 'nagios_contact');
  756. return adminLoginName.value + ' / (' + adminEmail.value + ')';
  757. },
  758. /**
  759. * Onclick handler for <code>next</code> button
  760. * @method submit
  761. * @return {App.ModalPopup|null}
  762. */
  763. submit: function () {
  764. if (this.get('isSubmitDisabled')) return null;
  765. if ((this.get('content.controllerName') == 'addHostController') && this.get('securityEnabled')) {
  766. var self = this;
  767. return App.showConfirmationPopup(function () {
  768. self.submitProceed();
  769. }, Em.I18n.t('installer.step8.securityConfirmationPopupBody'));
  770. }
  771. else {
  772. return this.submitProceed();
  773. }
  774. },
  775. /**
  776. * Update configurations for installed services.
  777. * Do separated PUT-request for each siteName for each service
  778. *
  779. * @param {Array} fileNamesToUpdate - file names that should be updated
  780. * @method updateConfigurations
  781. */
  782. updateConfigurations: function (fileNamesToUpdate) {
  783. var configurationController = App.router.get('mainServiceInfoConfigsController');
  784. var configs = this.get('configs').slice(0);
  785. var configsMap = [];
  786. fileNamesToUpdate.forEach(function (fileName) {
  787. if (!fileName || /^(core)/.test(fileName)) return;
  788. var tagName = 'version' + (new Date).getTime();
  789. var configsToSave = configs.filterProperty('filename', fileName);
  790. configsToSave.forEach(function (item) {
  791. item.value = App.config.trimProperty(item, false);
  792. });
  793. configsMap.push(configurationController.createSiteObj(fileName.replace(".xml", ""), tagName, configsToSave));
  794. }, this);
  795. if (!configsMap.length) return;
  796. var configData = configsMap.map(function (siteConfigObject) {
  797. return JSON.stringify({
  798. Clusters: {
  799. desired_config: {
  800. type: siteConfigObject.type,
  801. tag: siteConfigObject.tag,
  802. properties: siteConfigObject.properties,
  803. properties_attributes: siteConfigObject.properties_attributes
  804. }
  805. }
  806. });
  807. }, this).toString();
  808. this.addRequestToAjaxQueue({
  809. name: 'wizard.step8.apply_configuration_to_cluster',
  810. data: {
  811. data: '[' + configData + ']'
  812. }
  813. });
  814. },
  815. /**
  816. * Prepare <code>ajaxQueue</code> and start to execute it
  817. * @method submitProceed
  818. */
  819. submitProceed: function () {
  820. var self = this;
  821. this.set('isSubmitDisabled', true);
  822. this.set('isBackBtnDisabled', true);
  823. if (this.get('content.controllerName') == 'addHostController') {
  824. App.router.get('addHostController').setLowerStepsDisable(4);
  825. }
  826. // checkpoint the cluster status on the server so that the user can resume from where they left off
  827. switch (this.get('content.controllerName')) {
  828. case 'installerController':
  829. App.clusterStatus.setClusterStatus({
  830. clusterName: this.get('clusterName'),
  831. clusterState: 'CLUSTER_DEPLOY_PREP_2',
  832. wizardControllerName: this.get('content.controllerName'),
  833. localdb: App.db.data
  834. });
  835. break;
  836. case 'addHostController':
  837. App.clusterStatus.setClusterStatus({
  838. clusterName: this.get('clusterName'),
  839. clusterState: 'ADD_HOSTS_DEPLOY_PREP_2',
  840. wizardControllerName: this.get('content.controllerName'),
  841. localdb: App.db.data
  842. });
  843. break;
  844. case 'addServiceController':
  845. App.clusterStatus.setClusterStatus({
  846. clusterName: this.get('clusterName'),
  847. clusterState: 'ADD_SERVICES_DEPLOY_PREP_2',
  848. wizardControllerName: this.get('content.controllerName'),
  849. localdb: App.db.data
  850. });
  851. break;
  852. default:
  853. break;
  854. }
  855. // delete any existing clusters to start from a clean slate
  856. // before creating a new cluster in install wizard
  857. // TODO: modify for multi-cluster support
  858. this.getExistingClusterNames().complete(function () {
  859. var clusterNames = self.get('clusterNames');
  860. if (self.get('content.controllerName') == 'installerController' && (!App.get('testMode')) && clusterNames.length) {
  861. self.deleteClusters(clusterNames);
  862. } else {
  863. self.deleteClustersCallback(null, null, {isLast: true});
  864. }
  865. });
  866. },
  867. /**
  868. * Get list of existing cluster names
  869. * @returns {object|null}
  870. * returns an array of existing cluster names.
  871. * returns an empty array if there are no existing clusters.
  872. * @method getExistingClusterNames
  873. */
  874. getExistingClusterNames: function () {
  875. return App.ajax.send({
  876. name: 'wizard.step8.existing_cluster_names',
  877. sender: this,
  878. success: 'getExistingClusterNamesSuccessCallBack',
  879. error: 'getExistingClusterNamesErrorCallback'
  880. });
  881. },
  882. /**
  883. * Save received list to <code>clusterNames</code>
  884. * @param {Object} data
  885. * @method getExistingClusterNamesSuccessCallBack
  886. */
  887. getExistingClusterNamesSuccessCallBack: function (data) {
  888. var clusterNames = data.items.mapProperty('Clusters.cluster_name');
  889. console.log("Got existing cluster names: " + clusterNames);
  890. this.set('clusterNames', clusterNames);
  891. },
  892. /**
  893. * If error appears, set <code>clusterNames</code> to <code>[]</code>
  894. * @method getExistingClusterNamesErrorCallback
  895. */
  896. getExistingClusterNamesErrorCallback: function () {
  897. console.log("Failed to get existing cluster names");
  898. this.set('clusterNames', []);
  899. },
  900. /**
  901. * Delete cluster by name
  902. * One request for one cluster!
  903. * @param {string[]} clusterNames
  904. * @method deleteClusters
  905. */
  906. deleteClusters: function (clusterNames) {
  907. clusterNames.forEach(function (clusterName, index) {
  908. App.ajax.send({
  909. name: 'common.delete.cluster',
  910. sender: this,
  911. data: {
  912. name: clusterName,
  913. isLast: index == clusterNames.length - 1
  914. },
  915. success: 'deleteClustersCallback',
  916. error: 'deleteClustersCallback'
  917. });
  918. }, this);
  919. },
  920. deleteClustersCallback: function (response, request, data) {
  921. if (data.isLast) {
  922. this.setLocalRepositories();
  923. this.createCluster();
  924. this.createSelectedServices();
  925. if (this.get('content.controllerName') !== 'addHostController') {
  926. if (this.get('wizardController').getDBProperty('fileNamesToUpdate') && this.get('wizardController').getDBProperty('fileNamesToUpdate').length) {
  927. this.updateConfigurations(this.get('wizardController').getDBProperty('fileNamesToUpdate'));
  928. }
  929. this.createConfigurations();
  930. this.applyConfigurationsToCluster();
  931. }
  932. this.createComponents();
  933. this.registerHostsToCluster();
  934. if (App.get('supports.hostOverridesInstaller')) {
  935. this.createConfigurationGroups();
  936. }
  937. this.createMasterHostComponents();
  938. this.createSlaveAndClientsHostComponents();
  939. if (this.get('content.controllerName') === 'addServiceController') {
  940. this.createAdditionalClientComponents();
  941. }
  942. this.createAdditionalHostComponents();
  943. this.set('ajaxQueueLength', this.get('ajaxRequestsQueue.queue.length'));
  944. this.get('ajaxRequestsQueue').start();
  945. }
  946. },
  947. /**
  948. * Updates local repositories for the Ambari server.
  949. * @method setLocalRepositories
  950. * @return {bool} true - requests are sent, false - requests not sent
  951. */
  952. setLocalRepositories: function () {
  953. if (this.get('content.controllerName') !== 'installerController' || !App.get('supports.localRepositories')) return false;
  954. var self = this,
  955. stack = this.get('content.stacks').findProperty('isSelected', true);
  956. stack.operatingSystems.forEach(function (os) {
  957. if (os.baseUrl !== os.originalBaseUrl) {
  958. console.log("Updating local repository URL from " + os.originalBaseUrl + " -> " + os.baseUrl + ". ", os);
  959. self.addRequestToAjaxQueue({
  960. name: 'wizard.step8.set_local_repos',
  961. data: {
  962. osType: os.osType,
  963. repoId: os.repoId,
  964. stackVersionURL: App.get('stackVersionURL'),
  965. data: JSON.stringify({
  966. "Repositories": {
  967. "base_url": os.baseUrl,
  968. "verify_base_url": false
  969. }
  970. })
  971. }
  972. });
  973. }
  974. });
  975. return true;
  976. },
  977. /**
  978. * *******************************************************************
  979. * The following create* functions are called upon submitting Step 8.
  980. * *******************************************************************
  981. */
  982. /**
  983. * Create cluster using selected stack version
  984. * Queued request
  985. * @method createCluster
  986. */
  987. createCluster: function () {
  988. if (this.get('content.controllerName') !== 'installerController') return;
  989. var stackVersion = (this.get('content.installOptions.localRepo')) ? App.currentStackVersion.replace(/(-\d+(\.\d)*)/ig, "Local$&") : App.currentStackVersion;
  990. this.addRequestToAjaxQueue({
  991. name: 'wizard.step8.create_cluster',
  992. data: {
  993. data: JSON.stringify({ "Clusters": {"version": stackVersion }})
  994. },
  995. success: 'createClusterSuccess'
  996. });
  997. },
  998. createClusterSuccess: function (data, xhr, params) {
  999. App.set('clusterName', params.cluster)
  1000. },
  1001. /**
  1002. * Create selected to install services
  1003. * Queued request
  1004. * Skipped if no services where selected!
  1005. * @method createSelectedServices
  1006. */
  1007. createSelectedServices: function () {
  1008. var data = this.createSelectedServicesData();
  1009. if (!data.length) return;
  1010. this.addRequestToAjaxQueue({
  1011. name: 'wizard.step8.create_selected_services',
  1012. data: {
  1013. data: JSON.stringify(data)
  1014. }
  1015. });
  1016. },
  1017. /**
  1018. * Format data for <code>createSelectedServices</code> request
  1019. * @returns {Object[]}
  1020. * @method createSelectedServicesData
  1021. */
  1022. createSelectedServicesData: function () {
  1023. return this.get('selectedServices').map(function (_service) {
  1024. return {"ServiceInfo": { "service_name": _service.get('serviceName') }};
  1025. });
  1026. },
  1027. /**
  1028. * Create components for selected services
  1029. * Queued requests
  1030. * One request for each service!
  1031. * @method createComponents
  1032. */
  1033. createComponents: function () {
  1034. var serviceComponents = App.StackServiceComponent.find();
  1035. this.get('selectedServices').forEach(function (_service) {
  1036. var serviceName = _service.get('serviceName');
  1037. var componentsData = serviceComponents.filterProperty('serviceName', serviceName).map(function (_component) {
  1038. return { "ServiceComponentInfo": { "component_name": _component.get('componentName') } };
  1039. });
  1040. // Service must be specified in terms of a query for creating multiple components at the same time.
  1041. // See AMBARI-1018.
  1042. this.addRequestToAjaxQueue({
  1043. name: 'wizard.step8.create_components',
  1044. data: {
  1045. data: JSON.stringify({"components": componentsData}),
  1046. serviceName: serviceName
  1047. }
  1048. });
  1049. }, this);
  1050. },
  1051. /**
  1052. * Error callback for new service component request
  1053. * So, if component doesn't exist we should create it
  1054. * @param {object} request
  1055. * @param {object} ajaxOptions
  1056. * @param {string} error
  1057. * @param {object} opt
  1058. * @param {object} params
  1059. * @method newServiceComponentErrorCallback
  1060. */
  1061. newServiceComponentErrorCallback: function (request, ajaxOptions, error, opt, params) {
  1062. this.addRequestToAjaxQueue({
  1063. name: 'wizard.step8.create_components',
  1064. data: {
  1065. serviceName: params.serviceName,
  1066. data: JSON.stringify({
  1067. "components": [
  1068. {
  1069. "ServiceComponentInfo": {
  1070. "component_name": params.componentName
  1071. }
  1072. }
  1073. ]
  1074. })
  1075. }
  1076. });
  1077. },
  1078. /**
  1079. * Register hosts
  1080. * Queued request
  1081. * @method registerHostsToCluster
  1082. */
  1083. registerHostsToCluster: function () {
  1084. var data = this.createRegisterHostData();
  1085. if (!data.length) return;
  1086. this.addRequestToAjaxQueue({
  1087. name: 'wizard.step8.register_host_to_cluster',
  1088. data: {
  1089. data: JSON.stringify(data)
  1090. }
  1091. });
  1092. },
  1093. /**
  1094. * Format request-data for <code>registerHostsToCluster</code>
  1095. * @returns {Object}
  1096. * @method createRegisterHostData
  1097. */
  1098. createRegisterHostData: function () {
  1099. return this.getRegisteredHosts().filterProperty('isInstalled', false).map(function (host) {
  1100. return {"Hosts": { "host_name": host.hostName}};
  1101. });
  1102. },
  1103. /**
  1104. * Register new master components
  1105. * @uses registerHostsToComponent
  1106. * @method createMasterHostComponents
  1107. */
  1108. createMasterHostComponents: function () {
  1109. // create master components for only selected services.
  1110. var selectedMasterComponents = this.get('content.masterComponentHosts').filter(function (_component) {
  1111. return this.get('selectedServices').mapProperty('serviceName').contains(_component.serviceId)
  1112. }, this);
  1113. selectedMasterComponents.mapProperty('component').uniq().forEach(function (component) {
  1114. var hostNames = selectedMasterComponents.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
  1115. this.registerHostsToComponent(hostNames, component);
  1116. }, this);
  1117. },
  1118. getClientsToMasterMap: function () {
  1119. var clientNames = App.StackServiceComponent.find().filterProperty('isClient').mapProperty('componentName'),
  1120. clientsMap = {},
  1121. dependedComponents = App.StackServiceComponent.find().filterProperty('isMaster');
  1122. clientNames.forEach(function (clientName) {
  1123. clientsMap[clientName] = Em.A([]);
  1124. dependedComponents.forEach(function (component) {
  1125. if (component.get('dependencies').contains(clientName)) clientsMap[clientName].push(component.get('componentName'));
  1126. });
  1127. if (!clientsMap[clientName].length) delete clientsMap[clientName];
  1128. });
  1129. return clientsMap;
  1130. },
  1131. /**
  1132. * Register slave components and clients
  1133. * @uses registerHostsToComponent
  1134. * @method createSlaveAndClientsHostComponents
  1135. */
  1136. createSlaveAndClientsHostComponents: function () {
  1137. var masterHosts = this.get('content.masterComponentHosts');
  1138. var slaveHosts = this.get('content.slaveComponentHosts');
  1139. var clients = this.get('content.clients').filterProperty('isInstalled',false);
  1140. /**
  1141. * Determines on which hosts client should be installed (based on availability of master components on hosts)
  1142. * @type {Object}
  1143. * Format:
  1144. * <code>
  1145. * {
  1146. * CLIENT1: Em.A([MASTER1, MASTER2, ...]),
  1147. * CLIENT2: Em.A([MASTER3, MASTER1, ...])
  1148. * ...
  1149. * }
  1150. * </code>
  1151. */
  1152. var clientsToMasterMap = this.getClientsToMasterMap();
  1153. slaveHosts.forEach(function (_slave) {
  1154. if (_slave.componentName !== 'CLIENT') {
  1155. var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
  1156. this.registerHostsToComponent(hostNames, _slave.componentName);
  1157. }
  1158. else {
  1159. clients.forEach(function (_client) {
  1160. var hostNames = _slave.hosts.mapProperty('hostName');
  1161. if (clientsToMasterMap[_client.component_name]) {
  1162. clientsToMasterMap[_client.component_name].forEach(function (componentName) {
  1163. masterHosts.filterProperty('component', componentName).forEach(function (_masterHost) {
  1164. hostNames.pushObject(_masterHost.hostName);
  1165. });
  1166. });
  1167. }
  1168. hostNames = hostNames.uniq();
  1169. this.registerHostsToComponent(hostNames, _client.component_name);
  1170. }, this);
  1171. }
  1172. }, this);
  1173. },
  1174. /**
  1175. * This function is specific to addServiceController
  1176. * Newly introduced master components requires some existing client components to be hosted along with them
  1177. */
  1178. createAdditionalClientComponents: function () {
  1179. var masterHosts = this.get('content.masterComponentHosts');
  1180. var clientsToMasterMap = this.getClientsToMasterMap();
  1181. var installedClients = [];
  1182. // Get all the installed Client components
  1183. this.get('content.services').filterProperty('isInstalled').forEach(function (_service) {
  1184. var serviceClients = App.StackServiceComponent.find().filterProperty('serviceName', _service.get('serviceName')).filterProperty('isClient');
  1185. serviceClients.forEach(function (client) {
  1186. installedClients.push(client.get('componentName'));
  1187. }, this);
  1188. }, this);
  1189. // Check if there is a dependency for being co-hosted between existing client and selected new master
  1190. installedClients.forEach(function (_clientName) {
  1191. if (clientsToMasterMap[_clientName]) {
  1192. var hostNames = [];
  1193. clientsToMasterMap[_clientName].forEach(function (componentName) {
  1194. masterHosts.filterProperty('component', componentName).filterProperty('isInstalled', false).forEach(function (_masterHost) {
  1195. hostNames.pushObject(_masterHost.hostName);
  1196. }, this);
  1197. }, this);
  1198. hostNames = hostNames.uniq();
  1199. this.get('content.additionalClients').pushObject({hostNames: hostNames, componentName: _clientName});
  1200. // If a dependency for being co-hosted is derived between existing client and selected new master but that
  1201. // dependency is already satisfied in the cluster then disregard the derived dependency
  1202. this.removeClientsFromList(_clientName, hostNames);
  1203. this.registerHostsToComponent(hostNames, _clientName);
  1204. }
  1205. }, this);
  1206. },
  1207. /**
  1208. *
  1209. * @param clientName
  1210. * @param hostList
  1211. */
  1212. removeClientsFromList: function (clientName, hostList) {
  1213. var clientHosts = [];
  1214. var installedHosts = this.get('content.hosts');
  1215. for (var hostName in installedHosts) {
  1216. if (installedHosts[hostName].isInstalled) {
  1217. if (installedHosts[hostName].hostComponents.mapProperty('HostRoles.component_name').contains(clientName)) {
  1218. clientHosts.push(hostName);
  1219. }
  1220. }
  1221. }
  1222. if (clientHosts.length > 0) {
  1223. clientHosts.forEach(function (hostName) {
  1224. if (hostList.contains(hostName)) {
  1225. hostList.splice(hostList.indexOf(hostName), 1);
  1226. }
  1227. }, this);
  1228. }
  1229. },
  1230. /**
  1231. * Register additional components
  1232. * Based on availability of some services
  1233. * @uses registerHostsToComponent
  1234. * @method createAdditionalHostComponents
  1235. */
  1236. createAdditionalHostComponents: function () {
  1237. var masterHosts = this.get('content.masterComponentHosts');
  1238. // add MySQL Server if Hive is selected
  1239. // add Ganglia Monitor (Slave) to all hosts if Ganglia service is selected
  1240. var gangliaService = this.get('content.services').filterProperty('isSelected').findProperty('serviceName', 'GANGLIA');
  1241. if (gangliaService) {
  1242. var hosts = this.getRegisteredHosts();
  1243. if (gangliaService.get('isInstalled')) {
  1244. hosts = hosts.filterProperty('isInstalled', false);
  1245. }
  1246. if (hosts.length) {
  1247. this.registerHostsToComponent(hosts.mapProperty('hostName'), 'GANGLIA_MONITOR');
  1248. }
  1249. }
  1250. var hiveService = this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false).findProperty('serviceName', 'HIVE');
  1251. if (hiveService) {
  1252. var hiveDb = this.get('content.serviceConfigProperties').findProperty('name', 'hive_database');
  1253. if (hiveDb.value == "New MySQL Database") {
  1254. this.registerHostsToComponent(masterHosts.filterProperty('component', 'HIVE_SERVER').mapProperty('hostName'), 'MYSQL_SERVER');
  1255. }
  1256. }
  1257. },
  1258. /**
  1259. * Register component to hosts
  1260. * Queued request
  1261. * @param {String[]} hostNames
  1262. * @param {String} componentName
  1263. * @method registerHostsToComponent
  1264. */
  1265. registerHostsToComponent: function (hostNames, componentName) {
  1266. if (!hostNames.length) return;
  1267. var queryStr = '';
  1268. hostNames.forEach(function (hostName) {
  1269. queryStr += 'Hosts/host_name=' + hostName + '|';
  1270. });
  1271. //slice off last symbol '|'
  1272. queryStr = queryStr.slice(0, -1);
  1273. var data = {
  1274. "RequestInfo": {
  1275. "query": queryStr
  1276. },
  1277. "Body": {
  1278. "host_components": [
  1279. {
  1280. "HostRoles": {
  1281. "component_name": componentName
  1282. }
  1283. }
  1284. ]
  1285. }
  1286. };
  1287. this.addRequestToAjaxQueue({
  1288. name: 'wizard.step8.register_host_to_component',
  1289. data: {
  1290. data: JSON.stringify(data)
  1291. }
  1292. });
  1293. },
  1294. /**
  1295. * Compare generated config object with current configs that were filled
  1296. * on "Customize Services" page.
  1297. *
  1298. * @param {Object} properties - generated by createSiteObj|createCoreSiteObj
  1299. * @param {Array} configs - current configs to compare
  1300. * @return {Boolean}
  1301. * @method isConfigsChanged
  1302. **/
  1303. isConfigsChanged: function (properties, configs) {
  1304. var isChanged = false;
  1305. for (var property in properties) {
  1306. var config = configs.findProperty('name', property);
  1307. // if config not found then it's looks like a new config
  1308. if (!config) {
  1309. isChanged = true;
  1310. } else {
  1311. if (!config.hasInitialValue || config.isNotDefaultValue) {
  1312. isChanged = true;
  1313. }
  1314. }
  1315. }
  1316. return isChanged;
  1317. },
  1318. /**
  1319. * Create config objects for cluster and services
  1320. * @method createConfigurations
  1321. */
  1322. createConfigurations: function () {
  1323. var selectedServices = this.get('selectedServices');
  1324. var coreSiteObject = this.createCoreSiteObj();
  1325. var tag = 'version1';
  1326. if (this.get('content.controllerName') == 'addServiceController') {
  1327. tag = 'version' + (new Date).getTime();
  1328. coreSiteObject.tag = tag;
  1329. var coreSiteConfigs = this.get('configs').filterProperty('filename', 'core-site.xml');
  1330. if (this.isConfigsChanged(coreSiteObject.properties, coreSiteConfigs))
  1331. this.get('serviceConfigTags').pushObject(coreSiteObject);
  1332. }
  1333. selectedServices.forEach(function (service) {
  1334. Object.keys(service.get('configTypes')).forEach(function (type) {
  1335. if (!this.get('serviceConfigTags').someProperty('type', type)) {
  1336. if (!App.supports.capacitySchedulerUi && service.get('serviceName') === 'MAPREDUCE' && (type === 'capacity-scheduler' || type === 'mapred-queue-acls')) {
  1337. return;
  1338. } else if (type === 'core-site') {
  1339. this.get('serviceConfigTags').pushObject(coreSiteObject);
  1340. } else if (type === 'storm-site') {
  1341. this.get('serviceConfigTags').pushObject(this.createStormSiteObj(tag));
  1342. } else if (type === 'zoo.cfg') {
  1343. this.get('serviceConfigTags').pushObject(this.createZooCfgObj(tag));
  1344. } else {
  1345. var isNonXmlFile = type.endsWith('log4j') || type.endsWith('env') || type.endsWith('properties') || type.endsWith('conf');
  1346. this.get('serviceConfigTags').pushObject(this.createSiteObj(type, isNonXmlFile, tag));
  1347. }
  1348. }
  1349. }, this);
  1350. }, this);
  1351. },
  1352. /**
  1353. * Send <code>serviceConfigTags</code> to server
  1354. * Queued request
  1355. * One request for each service config tag
  1356. * @method applyConfigurationsToCluster
  1357. */
  1358. applyConfigurationsToCluster: function () {
  1359. var configData = this.get('serviceConfigTags').map(function (_serviceConfig) {
  1360. return JSON.stringify({
  1361. Clusters: {
  1362. desired_config: {
  1363. type: _serviceConfig.type,
  1364. tag: _serviceConfig.tag,
  1365. properties: _serviceConfig.properties,
  1366. properties_attributes: _serviceConfig.properties_attributes
  1367. }
  1368. }
  1369. });
  1370. }, this).toString();
  1371. this.addRequestToAjaxQueue({
  1372. name: 'wizard.step8.apply_configuration_to_cluster',
  1373. data: {
  1374. data: '[' + configData + ']'
  1375. }
  1376. });
  1377. },
  1378. /**
  1379. * Create and update config groups
  1380. * @method createConfigurationGroups
  1381. */
  1382. createConfigurationGroups: function () {
  1383. var configGroups = this.get('content.configGroups').filterProperty('isDefault', false);
  1384. var clusterName = this.get('clusterName');
  1385. var sendData = [];
  1386. var updateData = [];
  1387. var serviceConfigController = App.router.get('mainServiceInfoConfigsController');
  1388. var timeTag = (new Date).getTime();
  1389. var groupsToDelete = App.router.get(this.get('content.controllerName')).getDBProperty('groupsToDelete');
  1390. if (groupsToDelete && groupsToDelete.length > 0) {
  1391. this.removeInstalledServicesConfigurationGroups(groupsToDelete);
  1392. }
  1393. configGroups.forEach(function (configGroup) {
  1394. var groupConfigs = [];
  1395. var groupData = {
  1396. "cluster_name": clusterName,
  1397. "group_name": configGroup.name,
  1398. "tag": configGroup.service.id,
  1399. "description": configGroup.description,
  1400. "hosts": [],
  1401. "desired_configs": []
  1402. };
  1403. configGroup.hosts.forEach(function (hostName) {
  1404. groupData.hosts.push({"host_name": hostName});
  1405. });
  1406. // get properties that was created for non-default config group
  1407. configGroup.properties = configGroup.properties.concat(this.get('customNonDefaultGroupConfigs').filterProperty('group', configGroup.name));
  1408. //wrap properties into Em.Object to make them compatible with buildGroupDesiredConfigs method
  1409. configGroup.properties.forEach(function (property) {
  1410. groupConfigs.push(Em.Object.create(property));
  1411. });
  1412. groupData.desired_configs = serviceConfigController.buildGroupDesiredConfigs.call(serviceConfigController, groupConfigs, timeTag);
  1413. // check for group from installed service
  1414. if (configGroup.isForUpdate === true) {
  1415. // if group is a new one, create it
  1416. if (!configGroup.id) {
  1417. sendData.push({"ConfigGroup": groupData});
  1418. } else {
  1419. // update an existing group
  1420. groupData.id = configGroup.id;
  1421. updateData.push({"ConfigGroup": groupData});
  1422. }
  1423. } else {
  1424. sendData.push({"ConfigGroup": groupData});
  1425. }
  1426. //each group should have unique tag to prevent overriding configs from common sites
  1427. timeTag++;
  1428. }, this);
  1429. if (sendData.length > 0) {
  1430. this.applyConfigurationGroups(sendData);
  1431. }
  1432. if (updateData.length > 0) {
  1433. this.applyInstalledServicesConfigurationGroup(updateData);
  1434. }
  1435. },
  1436. /**
  1437. * Create new config groups request
  1438. * Queued request
  1439. * @param {Object[]} sendData
  1440. * @method applyConfigurationGroups
  1441. */
  1442. applyConfigurationGroups: function (sendData) {
  1443. this.addRequestToAjaxQueue({
  1444. name: 'wizard.step8.apply_configuration_groups',
  1445. data: {
  1446. data: JSON.stringify(sendData)
  1447. }
  1448. });
  1449. },
  1450. /**
  1451. * Update existed config groups
  1452. * Separated request for each group
  1453. * @param {Object[]} updateData
  1454. * @method applyInstalledServicesConfigurationGroup
  1455. */
  1456. applyInstalledServicesConfigurationGroup: function (updateData) {
  1457. updateData.forEach(function (item) {
  1458. App.router.get('mainServiceInfoConfigsController').putConfigGroupChanges(item);
  1459. });
  1460. },
  1461. /**
  1462. * Delete selected config groups
  1463. * @param {Object[]} groupsToDelete
  1464. * @method removeInstalledServicesConfigurationGroups
  1465. */
  1466. removeInstalledServicesConfigurationGroups: function (groupsToDelete) {
  1467. groupsToDelete.forEach(function (item) {
  1468. App.config.deleteConfigGroup(Em.Object.create(item));
  1469. });
  1470. },
  1471. /**
  1472. * Create Core Site object
  1473. * @returns {{type: string, tag: string, properties: {}}}
  1474. * @method createCoreSiteObj
  1475. */
  1476. createCoreSiteObj: function () {
  1477. var installedAndSelectedServices = Em.A([]);
  1478. installedAndSelectedServices.pushObjects(this.get('installedServices'));
  1479. installedAndSelectedServices.pushObjects(this.get('selectedServices'));
  1480. var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml'),
  1481. coreSiteProperties = {},
  1482. // some configs needs to be skipped if services are not selected
  1483. isOozieSelected = installedAndSelectedServices.someProperty('serviceName', 'OOZIE'),
  1484. oozieUser = this.get('configs').someProperty('name', 'oozie_user') ? this.get('configs').findProperty('name', 'oozie_user').value : null,
  1485. isHiveSelected = installedAndSelectedServices.someProperty('serviceName', 'HIVE'),
  1486. hiveUser = this.get('configs').someProperty('name', 'hive_user') ? this.get('configs').findProperty('name', 'hive_user').value : null,
  1487. isHcatSelected = installedAndSelectedServices.someProperty('serviceName', 'WEBHCAT'),
  1488. hcatUser = this.get('configs').someProperty('name', 'hcat_user') ? this.get('configs').findProperty('name', 'hcat_user').value : null,
  1489. isGLUSTERFSSelected = installedAndSelectedServices.someProperty('serviceName', 'GLUSTERFS');
  1490. // screen out the GLUSTERFS-specific core-site.xml entries when they are not needed
  1491. if (!isGLUSTERFSSelected) {
  1492. coreSiteObj = coreSiteObj.filter(function (_config) {
  1493. return !_config.name.contains("fs.glusterfs");
  1494. });
  1495. }
  1496. coreSiteObj.forEach(function (_coreSiteObj) {
  1497. // exclude some configs if service wasn't selected
  1498. if (
  1499. (isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) &&
  1500. (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) &&
  1501. (isHcatSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) {
  1502. coreSiteProperties[_coreSiteObj.name] = App.config.escapeXMLCharacters(_coreSiteObj.value);
  1503. }
  1504. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.default.name") {
  1505. coreSiteProperties[_coreSiteObj.name] =
  1506. this.get('configs').someProperty('name', 'fs_glusterfs_default_name') ?
  1507. App.config.escapeXMLCharacters(this.get('configs').findProperty('name', 'fs_glusterfs_default_name').value) : null;
  1508. }
  1509. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.defaultFS") {
  1510. coreSiteProperties[_coreSiteObj.name] =
  1511. this.get('configs').someProperty('name', 'glusterfs_defaultFS_name') ?
  1512. App.config.escapeXMLCharacters(this.get('configs').findProperty('name', 'glusterfs_defaultFS_name').value) : null;
  1513. }
  1514. }, this);
  1515. var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(coreSiteObj);
  1516. var configObj = {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
  1517. if (attributes) {
  1518. configObj['properties_attributes'] = attributes;
  1519. }
  1520. return configObj;
  1521. },
  1522. /**
  1523. * Create siteObj for custom service with it own configs
  1524. * @param {string} site
  1525. * @param {bool} isNonXmlFile
  1526. * @param tag
  1527. * @returns {{type: string, tag: string, properties: {}}}
  1528. * @method createSiteObj
  1529. */
  1530. createSiteObj: function (site, isNonXmlFile, tag) {
  1531. var properties = {};
  1532. var configs = this.get('configs').filterProperty('filename', site + '.xml');
  1533. var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(configs);
  1534. configs.forEach(function (_configProperty) {
  1535. if (isNonXmlFile) {
  1536. var heapsizeExceptions = ['hadoop_heapsize', 'yarn_heapsize', 'nodemanager_heapsize', 'resourcemanager_heapsize', 'apptimelineserver_heapsize', 'jobhistory_heapsize'];
  1537. // do not pass any globals whose name ends with _host or _hosts
  1538. if (_configProperty.isRequiredByAgent !== false) {
  1539. // append "m" to JVM memory options except for heapsizeExtensions
  1540. if (/_heapsize|_newsize|_maxnewsize$/.test(_configProperty.name) && !heapsizeExceptions.contains(_configProperty.name)) {
  1541. properties[_configProperty.name] = _configProperty.value + "m";
  1542. } else {
  1543. properties[_configProperty.name] = _configProperty.value;
  1544. }
  1545. }
  1546. } else {
  1547. properties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1548. }
  1549. }, this);
  1550. var configObj = {"type": site, "tag": tag, "properties": properties };
  1551. if (attributes) {
  1552. configObj['properties_attributes'] = attributes;
  1553. }
  1554. return configObj;
  1555. },
  1556. /**
  1557. * Create ZooKeeper Cfg Object
  1558. * @param tag
  1559. * @returns {{type: string, tag: string, properties: {}}}
  1560. * @method createZooCfgObj
  1561. */
  1562. createZooCfgObj: function (tag) {
  1563. var configs = this.get('configs').filterProperty('filename', 'zoo.cfg');
  1564. var csProperties = {};
  1565. configs.forEach(function (_configProperty) {
  1566. csProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1567. }, this);
  1568. return {type: 'zoo.cfg', tag: tag, properties: csProperties};
  1569. },
  1570. /**
  1571. * Create site obj for Storm
  1572. * Some config-properties should be modified in custom way
  1573. * @param tag
  1574. * @returns {{type: string, tag: string, properties: {}}}
  1575. * @method createStormSiteObj
  1576. */
  1577. createStormSiteObj: function (tag) {
  1578. var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
  1579. var stormProperties = {};
  1580. var specialProperties = ["storm.zookeeper.servers", "nimbus.childopts", "supervisor.childopts", "worker.childopts"];
  1581. configs.forEach(function (_configProperty) {
  1582. if (specialProperties.contains(_configProperty.name)) {
  1583. if (_configProperty.name == "storm.zookeeper.servers") {
  1584. stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "'");
  1585. } else {
  1586. stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "");
  1587. }
  1588. } else {
  1589. stormProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1590. }
  1591. }, this);
  1592. return {type: 'storm-site', tag: tag, properties: stormProperties};
  1593. },
  1594. /**
  1595. * Navigate to next step after all requests are sent
  1596. * @method ajaxQueueFinished
  1597. */
  1598. ajaxQueueFinished: function () {
  1599. console.log('everything is loaded');
  1600. App.router.send('next');
  1601. },
  1602. /**
  1603. * We need to do a lot of ajax calls async in special order. To do this,
  1604. * generate array of ajax objects and then send requests step by step. All
  1605. * ajax objects are stored in <code>ajaxRequestsQueue</code>
  1606. *
  1607. * @param {Object} params object with ajax-request parameters like url, type, data etc
  1608. * @method addRequestToAjaxQueue
  1609. */
  1610. addRequestToAjaxQueue: function (params) {
  1611. if (App.get('testMode')) return;
  1612. params = jQuery.extend({
  1613. sender: this,
  1614. error: 'ajaxQueueRequestErrorCallback'
  1615. }, params);
  1616. params.data['cluster'] = this.get('clusterName');
  1617. this.get('ajaxRequestsQueue').addRequest(params);
  1618. },
  1619. /**
  1620. * Error callback for each queued ajax-request
  1621. * @param {object} xhr
  1622. * @param {string} status
  1623. * @param {string} error
  1624. * @method ajaxQueueRequestErrorCallback
  1625. */
  1626. ajaxQueueRequestErrorCallback: function (xhr, status, error) {
  1627. var responseText = JSON.parse(xhr.responseText);
  1628. var controller = App.router.get(App.clusterStatus.wizardControllerName);
  1629. controller.registerErrPopup(Em.I18n.t('common.error'), responseText.message);
  1630. this.set('hasErrorOccurred', true);
  1631. // an error will break the ajax call chain and allow submission again
  1632. this.set('isSubmitDisabled', false);
  1633. this.set('isBackBtnDisabled', false);
  1634. App.router.get(this.get('content.controllerName')).setStepsEnable();
  1635. }
  1636. });