step8_controller.js 62 KB

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