step8_controller.js 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749
  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.@each.isSelected','content.services.@each.isInstalled').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', 'oozie_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 == 'ubuntu12') 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 (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 = App.format.role(component.get('componentName')).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 componentName = component.get('isClient') ? Em.I18n.t('common.client').toUpperCase() : component.get('componentName');
  648. var hostsLength = this.get('content.slaveComponentHosts')
  649. .findProperty('componentName', componentName).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. this.applyConfigurationsToCluster(configsMap);
  797. },
  798. /**
  799. * Prepare <code>ajaxQueue</code> and start to execute it
  800. * @method submitProceed
  801. */
  802. submitProceed: function () {
  803. var self = this;
  804. this.set('isSubmitDisabled', true);
  805. this.set('isBackBtnDisabled', true);
  806. if (this.get('content.controllerName') == 'addHostController') {
  807. App.router.get('addHostController').setLowerStepsDisable(4);
  808. }
  809. // checkpoint the cluster status on the server so that the user can resume from where they left off
  810. switch (this.get('content.controllerName')) {
  811. case 'installerController':
  812. App.clusterStatus.setClusterStatus({
  813. clusterName: this.get('clusterName'),
  814. clusterState: 'CLUSTER_DEPLOY_PREP_2',
  815. wizardControllerName: this.get('content.controllerName'),
  816. localdb: App.db.data
  817. });
  818. break;
  819. case 'addHostController':
  820. App.clusterStatus.setClusterStatus({
  821. clusterName: this.get('clusterName'),
  822. clusterState: 'ADD_HOSTS_DEPLOY_PREP_2',
  823. wizardControllerName: this.get('content.controllerName'),
  824. localdb: App.db.data
  825. });
  826. break;
  827. case 'addServiceController':
  828. App.clusterStatus.setClusterStatus({
  829. clusterName: this.get('clusterName'),
  830. clusterState: 'ADD_SERVICES_DEPLOY_PREP_2',
  831. wizardControllerName: this.get('content.controllerName'),
  832. localdb: App.db.data
  833. });
  834. break;
  835. default:
  836. break;
  837. }
  838. // delete any existing clusters to start from a clean slate
  839. // before creating a new cluster in install wizard
  840. // TODO: modify for multi-cluster support
  841. this.getExistingClusterNames().complete(function () {
  842. var clusterNames = self.get('clusterNames');
  843. if (self.get('content.controllerName') == 'installerController' && (!App.get('testMode')) && clusterNames.length) {
  844. self.deleteClusters(clusterNames);
  845. } else {
  846. self.deleteClustersCallback(null, null, {isLast: true});
  847. }
  848. });
  849. },
  850. /**
  851. * Get list of existing cluster names
  852. * @returns {object|null}
  853. * returns an array of existing cluster names.
  854. * returns an empty array if there are no existing clusters.
  855. * @method getExistingClusterNames
  856. */
  857. getExistingClusterNames: function () {
  858. return App.ajax.send({
  859. name: 'wizard.step8.existing_cluster_names',
  860. sender: this,
  861. success: 'getExistingClusterNamesSuccessCallBack',
  862. error: 'getExistingClusterNamesErrorCallback'
  863. });
  864. },
  865. /**
  866. * Save received list to <code>clusterNames</code>
  867. * @param {Object} data
  868. * @method getExistingClusterNamesSuccessCallBack
  869. */
  870. getExistingClusterNamesSuccessCallBack: function (data) {
  871. var clusterNames = data.items.mapProperty('Clusters.cluster_name');
  872. console.log("Got existing cluster names: " + clusterNames);
  873. this.set('clusterNames', clusterNames);
  874. },
  875. /**
  876. * If error appears, set <code>clusterNames</code> to <code>[]</code>
  877. * @method getExistingClusterNamesErrorCallback
  878. */
  879. getExistingClusterNamesErrorCallback: function () {
  880. console.log("Failed to get existing cluster names");
  881. this.set('clusterNames', []);
  882. },
  883. /**
  884. * Delete cluster by name
  885. * One request for one cluster!
  886. * @param {string[]} clusterNames
  887. * @method deleteClusters
  888. */
  889. deleteClusters: function (clusterNames) {
  890. clusterNames.forEach(function (clusterName, index) {
  891. App.ajax.send({
  892. name: 'common.delete.cluster',
  893. sender: this,
  894. data: {
  895. name: clusterName,
  896. isLast: index == clusterNames.length - 1
  897. },
  898. success: 'deleteClustersCallback',
  899. error: 'deleteClustersCallback'
  900. });
  901. }, this);
  902. },
  903. deleteClustersCallback: function (response, request, data) {
  904. if (data.isLast) {
  905. this.setLocalRepositories();
  906. this.createCluster();
  907. this.createSelectedServices();
  908. if (this.get('content.controllerName') !== 'addHostController') {
  909. if (this.get('wizardController').getDBProperty('fileNamesToUpdate') && this.get('wizardController').getDBProperty('fileNamesToUpdate').length) {
  910. this.updateConfigurations(this.get('wizardController').getDBProperty('fileNamesToUpdate'));
  911. }
  912. this.createConfigurations();
  913. this.applyConfigurationsToCluster(this.get('serviceConfigTags'));
  914. }
  915. this.createComponents();
  916. this.registerHostsToCluster();
  917. if (App.get('supports.hostOverridesInstaller')) {
  918. this.createConfigurationGroups();
  919. }
  920. this.createMasterHostComponents();
  921. this.createSlaveAndClientsHostComponents();
  922. if (this.get('content.controllerName') === 'addServiceController') {
  923. this.createAdditionalClientComponents();
  924. }
  925. this.createAdditionalHostComponents();
  926. this.set('ajaxQueueLength', this.get('ajaxRequestsQueue.queue.length'));
  927. this.get('ajaxRequestsQueue').start();
  928. }
  929. },
  930. /**
  931. * Updates local repositories for the Ambari server.
  932. * @method setLocalRepositories
  933. * @return {bool} true - requests are sent, false - requests not sent
  934. */
  935. setLocalRepositories: function () {
  936. if (this.get('content.controllerName') !== 'installerController' || !App.get('supports.localRepositories')) return false;
  937. var self = this,
  938. stack = this.get('content.stacks').findProperty('isSelected', true);
  939. stack.operatingSystems.forEach(function (os) {
  940. if (os.baseUrl !== os.originalBaseUrl) {
  941. console.log("Updating local repository URL from " + os.originalBaseUrl + " -> " + os.baseUrl + ". ", os);
  942. self.addRequestToAjaxQueue({
  943. name: 'wizard.step8.set_local_repos',
  944. data: {
  945. osType: os.osType,
  946. repoId: os.repoId,
  947. stackVersionURL: App.get('stackVersionURL'),
  948. data: JSON.stringify({
  949. "Repositories": {
  950. "base_url": os.baseUrl,
  951. "verify_base_url": false
  952. }
  953. })
  954. }
  955. });
  956. }
  957. });
  958. return true;
  959. },
  960. /**
  961. * *******************************************************************
  962. * The following create* functions are called upon submitting Step 8.
  963. * *******************************************************************
  964. */
  965. /**
  966. * Create cluster using selected stack version
  967. * Queued request
  968. * @method createCluster
  969. */
  970. createCluster: function () {
  971. if (this.get('content.controllerName') !== 'installerController') return;
  972. var stackVersion = (this.get('content.installOptions.localRepo')) ? App.currentStackVersion.replace(/(-\d+(\.\d)*)/ig, "Local$&") : App.currentStackVersion;
  973. this.addRequestToAjaxQueue({
  974. name: 'wizard.step8.create_cluster',
  975. data: {
  976. data: JSON.stringify({ "Clusters": {"version": stackVersion }})
  977. },
  978. success: 'createClusterSuccess'
  979. });
  980. },
  981. createClusterSuccess: function (data, xhr, params) {
  982. App.set('clusterName', params.cluster)
  983. },
  984. /**
  985. * Create selected to install services
  986. * Queued request
  987. * Skipped if no services where selected!
  988. * @method createSelectedServices
  989. */
  990. createSelectedServices: function () {
  991. var data = this.createSelectedServicesData();
  992. if (!data.length) return;
  993. this.addRequestToAjaxQueue({
  994. name: 'wizard.step8.create_selected_services',
  995. data: {
  996. data: JSON.stringify(data)
  997. }
  998. });
  999. },
  1000. /**
  1001. * Format data for <code>createSelectedServices</code> request
  1002. * @returns {Object[]}
  1003. * @method createSelectedServicesData
  1004. */
  1005. createSelectedServicesData: function () {
  1006. return this.get('selectedServices').map(function (_service) {
  1007. return {"ServiceInfo": { "service_name": _service.get('serviceName') }};
  1008. });
  1009. },
  1010. /**
  1011. * Create components for selected services
  1012. * Queued requests
  1013. * One request for each service!
  1014. * @method createComponents
  1015. */
  1016. createComponents: function () {
  1017. var serviceComponents = App.StackServiceComponent.find();
  1018. this.get('selectedServices').forEach(function (_service) {
  1019. var serviceName = _service.get('serviceName');
  1020. var componentsData = serviceComponents.filterProperty('serviceName', serviceName).map(function (_component) {
  1021. return { "ServiceComponentInfo": { "component_name": _component.get('componentName') } };
  1022. });
  1023. // Service must be specified in terms of a query for creating multiple components at the same time.
  1024. // See AMBARI-1018.
  1025. this.addRequestToAjaxQueue({
  1026. name: 'wizard.step8.create_components',
  1027. data: {
  1028. data: JSON.stringify({"components": componentsData}),
  1029. serviceName: serviceName
  1030. }
  1031. });
  1032. }, this);
  1033. },
  1034. /**
  1035. * Error callback for new service component request
  1036. * So, if component doesn't exist we should create it
  1037. * @param {object} request
  1038. * @param {object} ajaxOptions
  1039. * @param {string} error
  1040. * @param {object} opt
  1041. * @param {object} params
  1042. * @method newServiceComponentErrorCallback
  1043. */
  1044. newServiceComponentErrorCallback: function (request, ajaxOptions, error, opt, params) {
  1045. this.addRequestToAjaxQueue({
  1046. name: 'wizard.step8.create_components',
  1047. data: {
  1048. serviceName: params.serviceName,
  1049. data: JSON.stringify({
  1050. "components": [
  1051. {
  1052. "ServiceComponentInfo": {
  1053. "component_name": params.componentName
  1054. }
  1055. }
  1056. ]
  1057. })
  1058. }
  1059. });
  1060. },
  1061. /**
  1062. * Register hosts
  1063. * Queued request
  1064. * @method registerHostsToCluster
  1065. */
  1066. registerHostsToCluster: function () {
  1067. var data = this.createRegisterHostData();
  1068. if (!data.length) return;
  1069. this.addRequestToAjaxQueue({
  1070. name: 'wizard.step8.register_host_to_cluster',
  1071. data: {
  1072. data: JSON.stringify(data)
  1073. }
  1074. });
  1075. },
  1076. /**
  1077. * Format request-data for <code>registerHostsToCluster</code>
  1078. * @returns {Object}
  1079. * @method createRegisterHostData
  1080. */
  1081. createRegisterHostData: function () {
  1082. return this.getRegisteredHosts().filterProperty('isInstalled', false).map(function (host) {
  1083. return {"Hosts": { "host_name": host.hostName}};
  1084. });
  1085. },
  1086. /**
  1087. * Register new master components
  1088. * @uses registerHostsToComponent
  1089. * @method createMasterHostComponents
  1090. */
  1091. createMasterHostComponents: function () {
  1092. // create master components for only selected services.
  1093. var selectedMasterComponents = this.get('content.masterComponentHosts').filter(function (_component) {
  1094. return this.get('selectedServices').mapProperty('serviceName').contains(_component.serviceId)
  1095. }, this);
  1096. selectedMasterComponents.mapProperty('component').uniq().forEach(function (component) {
  1097. var hostNames = selectedMasterComponents.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
  1098. this.registerHostsToComponent(hostNames, component);
  1099. }, this);
  1100. },
  1101. getClientsToMasterMap: function () {
  1102. var clientNames = App.StackServiceComponent.find().filterProperty('isClient').mapProperty('componentName'),
  1103. clientsMap = {},
  1104. dependedComponents = App.StackServiceComponent.find().filterProperty('isMaster');
  1105. clientNames.forEach(function (clientName) {
  1106. clientsMap[clientName] = Em.A([]);
  1107. dependedComponents.forEach(function (component) {
  1108. if (component.get('dependencies').contains(clientName)) clientsMap[clientName].push(component.get('componentName'));
  1109. });
  1110. if (!clientsMap[clientName].length) delete clientsMap[clientName];
  1111. });
  1112. return clientsMap;
  1113. },
  1114. /**
  1115. * Register slave components and clients
  1116. * @uses registerHostsToComponent
  1117. * @method createSlaveAndClientsHostComponents
  1118. */
  1119. createSlaveAndClientsHostComponents: function () {
  1120. var masterHosts = this.get('content.masterComponentHosts');
  1121. var slaveHosts = this.get('content.slaveComponentHosts');
  1122. var clients = this.get('content.clients').filterProperty('isInstalled', false);
  1123. /**
  1124. * Determines on which hosts client should be installed (based on availability of master components on hosts)
  1125. * @type {Object}
  1126. * Format:
  1127. * <code>
  1128. * {
  1129. * CLIENT1: Em.A([MASTER1, MASTER2, ...]),
  1130. * CLIENT2: Em.A([MASTER3, MASTER1, ...])
  1131. * ...
  1132. * }
  1133. * </code>
  1134. */
  1135. var clientsToMasterMap = this.getClientsToMasterMap();
  1136. slaveHosts.forEach(function (_slave) {
  1137. if (_slave.componentName !== 'CLIENT') {
  1138. var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
  1139. this.registerHostsToComponent(hostNames, _slave.componentName);
  1140. }
  1141. else {
  1142. clients.forEach(function (_client) {
  1143. var hostNames = _slave.hosts.mapProperty('hostName');
  1144. // The below logic to install clients to existing/New master hosts should not be applied to Add Host wizard.
  1145. // This is with the presumption that Add Host controller does not add any new Master component to the cluster
  1146. if (this.get('content.controllerName') !== 'addHostController') {
  1147. if (clientsToMasterMap[_client.component_name]) {
  1148. clientsToMasterMap[_client.component_name].forEach(function (componentName) {
  1149. masterHosts.filterProperty('component', componentName).forEach(function (_masterHost) {
  1150. hostNames.pushObject(_masterHost.hostName);
  1151. });
  1152. });
  1153. }
  1154. }
  1155. hostNames = hostNames.uniq();
  1156. this.registerHostsToComponent(hostNames, _client.component_name);
  1157. }, this);
  1158. }
  1159. }, this);
  1160. },
  1161. /**
  1162. * This function is specific to addServiceController
  1163. * Newly introduced master components requires some existing client components to be hosted along with them
  1164. */
  1165. createAdditionalClientComponents: function () {
  1166. var masterHosts = this.get('content.masterComponentHosts');
  1167. var clientsToMasterMap = this.getClientsToMasterMap();
  1168. var installedClients = [];
  1169. // Get all the installed Client components
  1170. this.get('content.services').filterProperty('isInstalled').forEach(function (_service) {
  1171. var serviceClients = App.StackServiceComponent.find().filterProperty('serviceName', _service.get('serviceName')).filterProperty('isClient');
  1172. serviceClients.forEach(function (client) {
  1173. installedClients.push(client.get('componentName'));
  1174. }, this);
  1175. }, this);
  1176. // Check if there is a dependency for being co-hosted between existing client and selected new master
  1177. installedClients.forEach(function (_clientName) {
  1178. if (clientsToMasterMap[_clientName]) {
  1179. var hostNames = [];
  1180. clientsToMasterMap[_clientName].forEach(function (componentName) {
  1181. masterHosts.filterProperty('component', componentName).filterProperty('isInstalled', false).forEach(function (_masterHost) {
  1182. hostNames.pushObject(_masterHost.hostName);
  1183. }, this);
  1184. }, this);
  1185. hostNames = hostNames.uniq();
  1186. if (hostNames.length > 0) {
  1187. this.get('content.additionalClients').pushObject({hostNames: hostNames, componentName: _clientName});
  1188. // If a dependency for being co-hosted is derived between existing client and selected new master but that
  1189. // dependency is already satisfied in the cluster then disregard the derived dependency
  1190. this.removeClientsFromList(_clientName, hostNames);
  1191. this.registerHostsToComponent(hostNames, _clientName);
  1192. }
  1193. }
  1194. }, this);
  1195. },
  1196. /**
  1197. *
  1198. * @param clientName
  1199. * @param hostList
  1200. */
  1201. removeClientsFromList: function (clientName, hostList) {
  1202. var clientHosts = [];
  1203. var installedHosts = this.get('content.hosts');
  1204. for (var hostName in installedHosts) {
  1205. if (installedHosts[hostName].isInstalled) {
  1206. if (installedHosts[hostName].hostComponents.mapProperty('HostRoles.component_name').contains(clientName)) {
  1207. clientHosts.push(hostName);
  1208. }
  1209. }
  1210. }
  1211. if (clientHosts.length > 0) {
  1212. clientHosts.forEach(function (hostName) {
  1213. if (hostList.contains(hostName)) {
  1214. hostList.splice(hostList.indexOf(hostName), 1);
  1215. }
  1216. }, this);
  1217. }
  1218. },
  1219. /**
  1220. * Register additional components
  1221. * Based on availability of some services
  1222. * @uses registerHostsToComponent
  1223. * @method createAdditionalHostComponents
  1224. */
  1225. createAdditionalHostComponents: function () {
  1226. var masterHosts = this.get('content.masterComponentHosts');
  1227. // add MySQL Server if Hive is selected
  1228. // add Ganglia Monitor (Slave) to all hosts if Ganglia service is selected
  1229. var gangliaService = this.get('content.services').filterProperty('isSelected').findProperty('serviceName', 'GANGLIA');
  1230. if (gangliaService) {
  1231. var hosts = this.getRegisteredHosts();
  1232. if (gangliaService.get('isInstalled')) {
  1233. hosts = hosts.filterProperty('isInstalled', false);
  1234. }
  1235. if (hosts.length) {
  1236. this.registerHostsToComponent(hosts.mapProperty('hostName'), 'GANGLIA_MONITOR');
  1237. }
  1238. }
  1239. var hiveService = this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false).findProperty('serviceName', 'HIVE');
  1240. if (hiveService) {
  1241. var hiveDb = this.get('content.serviceConfigProperties').findProperty('name', 'hive_database');
  1242. if (hiveDb.value == "New MySQL Database") {
  1243. this.registerHostsToComponent(masterHosts.filterProperty('component', 'HIVE_SERVER').mapProperty('hostName'), 'MYSQL_SERVER');
  1244. }
  1245. }
  1246. },
  1247. /**
  1248. * Register component to hosts
  1249. * Queued request
  1250. * @param {String[]} hostNames
  1251. * @param {String} componentName
  1252. * @method registerHostsToComponent
  1253. */
  1254. registerHostsToComponent: function (hostNames, componentName) {
  1255. if (!hostNames.length) return;
  1256. var queryStr = '';
  1257. hostNames.forEach(function (hostName) {
  1258. queryStr += 'Hosts/host_name=' + hostName + '|';
  1259. });
  1260. //slice off last symbol '|'
  1261. queryStr = queryStr.slice(0, -1);
  1262. var data = {
  1263. "RequestInfo": {
  1264. "query": queryStr
  1265. },
  1266. "Body": {
  1267. "host_components": [
  1268. {
  1269. "HostRoles": {
  1270. "component_name": componentName
  1271. }
  1272. }
  1273. ]
  1274. }
  1275. };
  1276. this.addRequestToAjaxQueue({
  1277. name: 'wizard.step8.register_host_to_component',
  1278. data: {
  1279. data: JSON.stringify(data)
  1280. }
  1281. });
  1282. },
  1283. /**
  1284. * Compare generated config object with current configs that were filled
  1285. * on "Customize Services" page.
  1286. *
  1287. * @param {Object} properties - generated by createSiteObj|createCoreSiteObj
  1288. * @param {Array} configs - current configs to compare
  1289. * @return {Boolean}
  1290. * @method isConfigsChanged
  1291. **/
  1292. isConfigsChanged: function (properties, configs) {
  1293. var isChanged = false;
  1294. for (var property in properties) {
  1295. var config = configs.findProperty('name', property);
  1296. // if config not found then it's looks like a new config
  1297. if (!config) {
  1298. isChanged = true;
  1299. } else {
  1300. if (!config.hasInitialValue || config.isNotDefaultValue) {
  1301. isChanged = true;
  1302. }
  1303. }
  1304. }
  1305. return isChanged;
  1306. },
  1307. /**
  1308. * Create config objects for cluster and services
  1309. * @method createConfigurations
  1310. */
  1311. createConfigurations: function () {
  1312. var selectedServices = this.get('selectedServices');
  1313. var coreSiteObject = this.createCoreSiteObj();
  1314. var tag = 'version1';
  1315. var clusterSiteObj = this.createSiteObj('cluster-env', tag);
  1316. if (this.get('content.controllerName') == 'installerController') {
  1317. this.get('serviceConfigTags').pushObject(clusterSiteObj);
  1318. }
  1319. if (this.get('content.controllerName') == 'addServiceController') {
  1320. tag = 'version' + (new Date).getTime();
  1321. coreSiteObject.tag = tag;
  1322. var coreSiteConfigs = this.get('configs').filterProperty('filename', 'core-site.xml');
  1323. if (this.isConfigsChanged(coreSiteObject.properties, coreSiteConfigs))
  1324. this.get('serviceConfigTags').pushObject(coreSiteObject);
  1325. }
  1326. selectedServices.forEach(function (service) {
  1327. Object.keys(service.get('configTypes')).forEach(function (type) {
  1328. if (!this.get('serviceConfigTags').someProperty('type', type)) {
  1329. var serviceVersionNotes = Em.I18n.t('dashboard.configHistory.table.notes.default').format(service.get('displayName'));
  1330. if (!App.supports.capacitySchedulerUi && service.get('serviceName') === 'MAPREDUCE' && (type === 'capacity-scheduler' || type === 'mapred-queue-acls')) {
  1331. return;
  1332. } else if (type === 'core-site') {
  1333. coreSiteObject.service_config_version_note = serviceVersionNotes
  1334. this.get('serviceConfigTags').pushObject(coreSiteObject);
  1335. } else if (type === 'storm-site') {
  1336. var obj = this.createStormSiteObj(tag);
  1337. obj.service_config_version_note = serviceVersionNotes;
  1338. this.get('serviceConfigTags').pushObject(obj);
  1339. } else if (type === 'zoo.cfg') {
  1340. var obj = this.createZooCfgObj(tag);
  1341. obj.service_config_version_note = serviceVersionNotes;
  1342. this.get('serviceConfigTags').pushObject(obj);
  1343. } else {
  1344. var obj = this.createSiteObj(type, tag);
  1345. obj.service_config_version_note = serviceVersionNotes;
  1346. this.get('serviceConfigTags').pushObject(obj);
  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. * @param serviceConfigTags
  1357. * @method applyConfigurationsToCluster
  1358. */
  1359. applyConfigurationsToCluster: function (serviceConfigTags) {
  1360. var selectedServices = this.get('selectedServices');
  1361. var allConfigData = [];
  1362. selectedServices.forEach(function (service) {
  1363. var serviceConfigData = [];
  1364. Object.keys(service.get('configTypesRendered')).forEach(function (type) {
  1365. var serviceConfigTag = serviceConfigTags.findProperty('type', type);
  1366. if (serviceConfigTag) {
  1367. serviceConfigData.pushObject(serviceConfigTag);
  1368. }
  1369. }, this);
  1370. allConfigData.pushObject(JSON.stringify({
  1371. Clusters: {
  1372. desired_config: serviceConfigData
  1373. }
  1374. }));
  1375. }, this);
  1376. var clusterConfig = serviceConfigTags.findProperty('type', 'cluster-env');
  1377. if (clusterConfig) {
  1378. allConfigData.pushObject(JSON.stringify({
  1379. Clusters: {
  1380. desired_config: [clusterConfig]
  1381. }
  1382. }));
  1383. }
  1384. this.addRequestToAjaxQueue({
  1385. name: 'common.across.services.configurations',
  1386. data: {
  1387. data: '[' + allConfigData.toString() + ']'
  1388. }
  1389. });
  1390. },
  1391. /**
  1392. * Create and update config groups
  1393. * @method createConfigurationGroups
  1394. */
  1395. createConfigurationGroups: function () {
  1396. var configGroups = this.get('content.configGroups').filterProperty('isDefault', false);
  1397. var clusterName = this.get('clusterName');
  1398. var sendData = [];
  1399. var updateData = [];
  1400. var serviceConfigController = App.router.get('mainServiceInfoConfigsController');
  1401. var timeTag = (new Date).getTime();
  1402. var groupsToDelete = App.router.get(this.get('content.controllerName')).getDBProperty('groupsToDelete');
  1403. if (groupsToDelete && groupsToDelete.length > 0) {
  1404. this.removeInstalledServicesConfigurationGroups(groupsToDelete);
  1405. }
  1406. configGroups.forEach(function (configGroup) {
  1407. var groupConfigs = [];
  1408. var groupData = {
  1409. "cluster_name": clusterName,
  1410. "group_name": configGroup.name,
  1411. "tag": configGroup.service.id,
  1412. "description": configGroup.description,
  1413. "hosts": [],
  1414. "desired_configs": []
  1415. };
  1416. configGroup.hosts.forEach(function (hostName) {
  1417. groupData.hosts.push({"host_name": hostName});
  1418. });
  1419. // get properties that was created for non-default config group
  1420. configGroup.properties = configGroup.properties.concat(this.get('customNonDefaultGroupConfigs').filterProperty('group', configGroup.name));
  1421. //wrap properties into Em.Object to make them compatible with buildGroupDesiredConfigs method
  1422. configGroup.properties.forEach(function (property) {
  1423. groupConfigs.push(Em.Object.create(property));
  1424. });
  1425. groupData.desired_configs = serviceConfigController.buildGroupDesiredConfigs.call(serviceConfigController, groupConfigs, timeTag);
  1426. // check for group from installed service
  1427. if (configGroup.isForInstalledService === true) {
  1428. // if group is a new one, create it
  1429. if (!configGroup.id) {
  1430. sendData.push({"ConfigGroup": groupData});
  1431. } else if (configGroup.isForUpdate){
  1432. // update an existing group
  1433. groupData.id = configGroup.id;
  1434. updateData.push({"ConfigGroup": groupData});
  1435. }
  1436. } else {
  1437. sendData.push({"ConfigGroup": groupData});
  1438. }
  1439. //each group should have unique tag to prevent overriding configs from common sites
  1440. timeTag++;
  1441. }, this);
  1442. if (sendData.length > 0) {
  1443. this.applyConfigurationGroups(sendData);
  1444. }
  1445. if (updateData.length > 0) {
  1446. this.applyInstalledServicesConfigurationGroup(updateData);
  1447. }
  1448. },
  1449. /**
  1450. * Create new config groups request
  1451. * Queued request
  1452. * @param {Object[]} sendData
  1453. * @method applyConfigurationGroups
  1454. */
  1455. applyConfigurationGroups: function (sendData) {
  1456. this.addRequestToAjaxQueue({
  1457. name: 'wizard.step8.apply_configuration_groups',
  1458. data: {
  1459. data: JSON.stringify(sendData)
  1460. }
  1461. });
  1462. },
  1463. /**
  1464. * Update existed config groups
  1465. * Separated request for each group
  1466. * @param {Object[]} updateData
  1467. * @method applyInstalledServicesConfigurationGroup
  1468. */
  1469. applyInstalledServicesConfigurationGroup: function (updateData) {
  1470. updateData.forEach(function (item) {
  1471. App.router.get('mainServiceInfoConfigsController').putConfigGroupChanges(item);
  1472. });
  1473. },
  1474. /**
  1475. * Delete selected config groups
  1476. * @param {Object[]} groupsToDelete
  1477. * @method removeInstalledServicesConfigurationGroups
  1478. */
  1479. removeInstalledServicesConfigurationGroups: function (groupsToDelete) {
  1480. groupsToDelete.forEach(function (item) {
  1481. App.config.deleteConfigGroup(Em.Object.create(item));
  1482. });
  1483. },
  1484. /**
  1485. * Create Core Site object
  1486. * @returns {{type: string, tag: string, properties: {}}}
  1487. * @method createCoreSiteObj
  1488. */
  1489. createCoreSiteObj: function () {
  1490. var installedAndSelectedServices = Em.A([]);
  1491. installedAndSelectedServices.pushObjects(this.get('installedServices'));
  1492. installedAndSelectedServices.pushObjects(this.get('selectedServices'));
  1493. var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml'),
  1494. coreSiteProperties = {},
  1495. // some configs needs to be skipped if services are not selected
  1496. isOozieSelected = installedAndSelectedServices.someProperty('serviceName', 'OOZIE'),
  1497. oozieUser = this.get('configs').someProperty('name', 'oozie_user') ? this.get('configs').findProperty('name', 'oozie_user').value : null,
  1498. isHiveSelected = installedAndSelectedServices.someProperty('serviceName', 'HIVE'),
  1499. hiveUser = this.get('configs').someProperty('name', 'hive_user') ? this.get('configs').findProperty('name', 'hive_user').value : null,
  1500. hcatUser = this.get('configs').someProperty('name', 'hcat_user') ? this.get('configs').findProperty('name', 'hcat_user').value : null,
  1501. isGLUSTERFSSelected = installedAndSelectedServices.someProperty('serviceName', 'GLUSTERFS');
  1502. coreSiteObj.forEach(function (_coreSiteObj) {
  1503. // exclude some configs if service wasn't selected
  1504. if (
  1505. (isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) &&
  1506. (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) &&
  1507. (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) {
  1508. coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
  1509. }
  1510. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.default.name") {
  1511. coreSiteProperties[_coreSiteObj.name] =
  1512. this.get('configs').someProperty('name', 'fs_glusterfs_default_name') ?
  1513. this.get('configs').findProperty('name', 'fs_glusterfs_default_name').value : null;
  1514. }
  1515. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.defaultFS") {
  1516. coreSiteProperties[_coreSiteObj.name] =
  1517. this.get('configs').someProperty('name', 'glusterfs_defaultFS_name') ?
  1518. this.get('configs').findProperty('name', 'glusterfs_defaultFS_name').value : null;
  1519. }
  1520. }, this);
  1521. var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(coreSiteObj);
  1522. var configObj = {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
  1523. if (attributes) {
  1524. configObj['properties_attributes'] = attributes;
  1525. }
  1526. return configObj;
  1527. },
  1528. /**
  1529. * Create siteObj for custom service with it own configs
  1530. * @param {string} site
  1531. * @param tag
  1532. * @returns {{type: string, tag: string, properties: {}}}
  1533. * @method createSiteObj
  1534. */
  1535. createSiteObj: function (site, tag) {
  1536. var properties = {};
  1537. var configs = this.get('configs').filterProperty('filename', site + '.xml');
  1538. var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(configs);
  1539. configs.forEach(function (_configProperty) {
  1540. var heapsizeExceptions = ['hadoop_heapsize', 'yarn_heapsize', 'nodemanager_heapsize', 'resourcemanager_heapsize', 'apptimelineserver_heapsize', 'jobhistory_heapsize'];
  1541. // do not pass any globals whose name ends with _host or _hosts
  1542. if (_configProperty.isRequiredByAgent !== false) {
  1543. // append "m" to JVM memory options except for heapsizeExtensions
  1544. if (/_heapsize|_newsize|_maxnewsize$/.test(_configProperty.name) && !heapsizeExceptions.contains(_configProperty.name)) {
  1545. properties[_configProperty.name] = _configProperty.value + "m";
  1546. } else {
  1547. properties[_configProperty.name] = _configProperty.value;
  1548. }
  1549. }
  1550. }, this);
  1551. var configObj = {"type": site, "tag": tag, "properties": properties };
  1552. if (attributes) {
  1553. configObj['properties_attributes'] = attributes;
  1554. }
  1555. return configObj;
  1556. },
  1557. /**
  1558. * Create ZooKeeper Cfg Object
  1559. * @param tag
  1560. * @returns {{type: string, tag: string, properties: {}}}
  1561. * @method createZooCfgObj
  1562. */
  1563. createZooCfgObj: function (tag) {
  1564. var configs = this.get('configs').filterProperty('filename', 'zoo.cfg');
  1565. var csProperties = {};
  1566. configs.forEach(function (_configProperty) {
  1567. csProperties[_configProperty.name] = _configProperty.value;
  1568. }, this);
  1569. return {type: 'zoo.cfg', tag: tag, properties: csProperties};
  1570. },
  1571. /**
  1572. * Create site obj for Storm
  1573. * Some config-properties should be modified in custom way
  1574. * @param tag
  1575. * @returns {{type: string, tag: string, properties: {}}}
  1576. * @method createStormSiteObj
  1577. */
  1578. createStormSiteObj: function (tag) {
  1579. var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
  1580. var stormProperties = {};
  1581. var specialProperties = ["storm.zookeeper.servers", "nimbus.childopts", "supervisor.childopts", "worker.childopts"];
  1582. configs.forEach(function (_configProperty) {
  1583. if (specialProperties.contains(_configProperty.name)) {
  1584. if (_configProperty.name == "storm.zookeeper.servers") {
  1585. stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "'");
  1586. } else {
  1587. stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "");
  1588. }
  1589. } else {
  1590. stormProperties[_configProperty.name] = _configProperty.value;
  1591. }
  1592. }, this);
  1593. return {type: 'storm-site', tag: tag, properties: stormProperties};
  1594. },
  1595. /**
  1596. * Navigate to next step after all requests are sent
  1597. * @method ajaxQueueFinished
  1598. */
  1599. ajaxQueueFinished: function () {
  1600. console.log('everything is loaded');
  1601. App.router.send('next');
  1602. },
  1603. /**
  1604. * We need to do a lot of ajax calls async in special order. To do this,
  1605. * generate array of ajax objects and then send requests step by step. All
  1606. * ajax objects are stored in <code>ajaxRequestsQueue</code>
  1607. *
  1608. * @param {Object} params object with ajax-request parameters like url, type, data etc
  1609. * @method addRequestToAjaxQueue
  1610. */
  1611. addRequestToAjaxQueue: function (params) {
  1612. if (App.get('testMode')) return;
  1613. params = jQuery.extend({
  1614. sender: this,
  1615. error: 'ajaxQueueRequestErrorCallback'
  1616. }, params);
  1617. params.data['cluster'] = this.get('clusterName');
  1618. this.get('ajaxRequestsQueue').addRequest(params);
  1619. },
  1620. /**
  1621. * Error callback for each queued ajax-request
  1622. * @param {object} xhr
  1623. * @param {string} status
  1624. * @param {string} error
  1625. * @method ajaxQueueRequestErrorCallback
  1626. */
  1627. ajaxQueueRequestErrorCallback: function (xhr, status, error) {
  1628. var responseText = JSON.parse(xhr.responseText);
  1629. var controller = App.router.get(App.clusterStatus.wizardControllerName);
  1630. controller.registerErrPopup(Em.I18n.t('common.error'), responseText.message);
  1631. this.set('hasErrorOccurred', true);
  1632. // an error will break the ajax call chain and allow submission again
  1633. this.set('isSubmitDisabled', false);
  1634. this.set('isBackBtnDisabled', false);
  1635. App.router.get(this.get('content.controllerName')).setStepsEnable();
  1636. }
  1637. });