step8_controller.js 62 KB

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