step8_controller.js 62 KB

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