step8_controller.js 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535
  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. rawContent: require('data/review_configs'),
  23. totalHosts: [],
  24. clusterInfo: [],
  25. services: [],
  26. configs: [],
  27. globals: [],
  28. ajaxQueue: [],
  29. configMapping: function(){
  30. return App.config.get('configMapping').all(true);
  31. }.property('App.config.configMapping'),
  32. slaveComponentConfig: null,
  33. isSubmitDisabled: false,
  34. isBackBtnDisabled: false,
  35. hasErrorOccurred: false,
  36. servicesInstalled: false,
  37. serviceConfigTags: [],
  38. securityEnabled: function() {
  39. return App.router.get('mainAdminSecurityController.securityEnabled');
  40. }.property('App.router.mainAdminSecurityController.securityEnabled'),
  41. /**
  42. * During page save time, we set the host overrides to the server.
  43. * The new host -> site:tag map is stored below. This will be
  44. * useful during save, to update the host's host components. Also,
  45. * it will be useful in deletion of overrides.
  46. *
  47. * Example:
  48. * {
  49. * 'hostname1': {
  50. * 'global': {
  51. * 'tagName': 'tag3187261938_hostname1',
  52. * 'map': {
  53. * 'hadoop_heapsize': '2048m'
  54. * }
  55. * }
  56. * }
  57. * }
  58. *
  59. * @see loadedHostToOverrideSiteToTagMap
  60. */
  61. savedHostToOverrideSiteToTagMap: {},
  62. selectedConfigGroup: null,
  63. configGroups: [],
  64. selectedServices: function () {
  65. return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false);
  66. }.property('content.services').cacheable(),
  67. clearStep: function () {
  68. this.get('services').clear();
  69. this.get('configs').clear();
  70. this.get('globals').clear();
  71. this.get('clusterInfo').clear();
  72. this.get('serviceConfigTags').clear();
  73. this.set('servicesInstalled', false);
  74. },
  75. loadStep: function () {
  76. console.log("TRACE: Loading step8: Review Page");
  77. if (this.get('content.controllerName') != 'installerController') {
  78. App.router.get('mainAdminSecurityController').setSecurityStatus();
  79. }
  80. this.clearStep();
  81. if (this.get('content.serviceConfigProperties')) {
  82. this.formatProperties();
  83. this.loadGlobals();
  84. this.loadConfigs();
  85. }
  86. this.loadClusterInfo();
  87. this.loadServices();
  88. this.set('isSubmitDisabled', false);
  89. this.set('isBackBtnDisabled', false);
  90. },
  91. /**
  92. * replace whitespace character with coma between directories
  93. */
  94. formatProperties: function(){
  95. this.get('content.serviceConfigProperties').forEach(function(_configProperty){
  96. _configProperty.value = App.config.trimProperty(_configProperty,false);
  97. });
  98. },
  99. loadGlobals: function () {
  100. var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
  101. if (globals.someProperty('name', 'hive_database')) {
  102. var hiveDb = globals.findProperty('name', 'hive_database');
  103. var hiveDbType = {name: 'hive_database_type', value: 'mysql'};
  104. var hiveJdbcDriver = {name: 'hive_jdbc_driver'};
  105. if (hiveDb.value === 'New MySQL Database') {
  106. if (globals.someProperty('name', 'hive_ambari_host')) {
  107. globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name', 'hive_ambari_host').value;
  108. hiveDbType.value = 'mysql';
  109. hiveJdbcDriver.value = 'com.mysql.jdbc.Driver';
  110. }
  111. globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_host'));
  112. globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_database'));
  113. globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
  114. globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
  115. } else if (hiveDb.value === 'Existing MySQL Database'){
  116. globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name', 'hive_existing_mysql_host').value;
  117. hiveDbType.value = 'mysql';
  118. hiveJdbcDriver.value = 'com.mysql.jdbc.Driver';
  119. globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
  120. globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
  121. globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_host'));
  122. globals = globals.without(globals.findProperty('name', 'hive_existing_oracle_database'));
  123. } else { //existing oracle database
  124. globals.findProperty('name', 'hive_hostname').value = globals.findProperty('name', 'hive_existing_oracle_host').value;
  125. hiveDbType.value = 'oracle';
  126. hiveJdbcDriver.value = 'oracle.jdbc.driver.OracleDriver';
  127. globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
  128. globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
  129. globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_host'));
  130. globals = globals.without(globals.findProperty('name', 'hive_existing_mysql_database'));
  131. }
  132. globals.push(hiveDbType);
  133. globals.push(hiveJdbcDriver);
  134. }
  135. if (globals.someProperty('name', 'oozie_database')) {
  136. var oozieDb = globals.findProperty('name', 'oozie_database');
  137. var oozieDbType = {name:'oozie_database_type'};
  138. var oozieJdbcDriver = {name: 'oozie_jdbc_driver'};
  139. if (oozieDb.value === 'New Derby Database') {
  140. globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name', 'oozie_ambari_host').value;
  141. oozieDbType.value = 'derby';
  142. oozieJdbcDriver.value = 'org.apache.derby.jdbc.EmbeddedDriver';
  143. globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
  144. globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
  145. globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
  146. globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
  147. globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
  148. globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
  149. } else if (oozieDb.value === 'Existing MySQL Database') {
  150. globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name', 'oozie_existing_mysql_host').value;
  151. oozieDbType.value = 'mysql';
  152. oozieJdbcDriver.value = 'com.mysql.jdbc.Driver';
  153. globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
  154. globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
  155. globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_host'));
  156. globals = globals.without(globals.findProperty('name', 'oozie_existing_oracle_database'));
  157. globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
  158. } else { // existing oracle database
  159. globals.findProperty('name', 'oozie_hostname').value = globals.findProperty('name', 'oozie_existing_oracle_host').value;
  160. oozieDbType.value = 'oracle';
  161. oozieJdbcDriver.value = 'oracle.jdbc.driver.OracleDriver';
  162. globals = globals.without(globals.findProperty('name', 'oozie_ambari_host'));
  163. globals = globals.without(globals.findProperty('name', 'oozie_ambari_database'));
  164. globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_host'));
  165. globals = globals.without(globals.findProperty('name', 'oozie_existing_mysql_database'));
  166. globals = globals.without(globals.findProperty('name', 'oozie_derby_database'));
  167. }
  168. globals.push(oozieDbType);
  169. globals.push(oozieJdbcDriver);
  170. }
  171. this.set('globals', globals);
  172. },
  173. loadConfigs: function () {
  174. //storedConfigs contains custom configs as well
  175. var serviceConfigProperties = this.get('content.serviceConfigProperties').filterProperty('id', 'site property');
  176. serviceConfigProperties.forEach(function(_config){
  177. _config.value = (typeof _config.value === "boolean") ? _config.value.toString() : _config.value;
  178. });
  179. var storedConfigs = serviceConfigProperties.filterProperty('value');
  180. var mappedConfigs = App.config.excludeUnsupportedConfigs(this.get('configMapping'), this.get('selectedServices').mapProperty('serviceName'));
  181. var uiConfigs = this.loadUiSideConfigs(mappedConfigs);
  182. this.set('configs', storedConfigs.concat(uiConfigs));
  183. },
  184. loadUiSideConfigs: function (configMapping) {
  185. var uiConfig = [];
  186. var configs = configMapping.filterProperty('foreignKey', null);
  187. this.addDynamicProperties(configs);
  188. configs.forEach(function (_config) {
  189. var valueWithOverrides = this.getGlobConfigValueWithOverrides(_config.templateName, _config.value, _config.name);
  190. uiConfig.pushObject({
  191. "id": "site property",
  192. "name": _config.name,
  193. "value": valueWithOverrides.value,
  194. "filename": _config.filename,
  195. "overrides": valueWithOverrides.overrides
  196. });
  197. }, this);
  198. var dependentConfig = $.extend(true, [], configMapping.filterProperty('foreignKey'));
  199. dependentConfig.forEach(function (_config) {
  200. App.config.setConfigValue(uiConfig, this.get('content.serviceConfigProperties'), _config, this.get('globals'));
  201. uiConfig.pushObject({
  202. "id": "site property",
  203. "name": _config._name || _config.name,
  204. "value": _config.value,
  205. "filename": _config.filename
  206. });
  207. }, this);
  208. return uiConfig;
  209. },
  210. addDynamicProperties: function(configs) {
  211. var templetonHiveProperty = this.get('content.serviceConfigProperties').someProperty('name', 'templeton.hive.properties');
  212. if (!templetonHiveProperty) {
  213. configs.pushObject({
  214. "name": "templeton.hive.properties",
  215. "templateName": ["hivemetastore_host"],
  216. "foreignKey": null,
  217. "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",
  218. "filename": "webhcat-site.xml"
  219. });
  220. }
  221. },
  222. getRegisteredHosts: function () {
  223. var allHosts = this.get('content.hosts');
  224. var hosts = [];
  225. for (var hostName in allHosts) {
  226. if (allHosts[hostName].bootStatus == 'REGISTERED') {
  227. allHosts[hostName].hostName = allHosts[hostName].name;
  228. hosts.pushObject(allHosts[hostName]);
  229. }
  230. }
  231. return hosts;
  232. },
  233. /**
  234. * Set all site property that are derived from other puppet-variable
  235. * @param {String} templateName
  236. * @param {String} expression
  237. * @param {String} name
  238. * @return {Object}
  239. * example: <code>{
  240. * value: '...',
  241. * overrides: {
  242. * 'value1': [h1, h2],
  243. * 'value2': [h3]
  244. * }
  245. * }</code>
  246. */
  247. getGlobConfigValueWithOverrides: function (templateName, expression, name) {
  248. var express = expression.match(/<(.*?)>/g);
  249. var value = expression;
  250. if (express == null) {
  251. return { value : expression, overrides: []}; // if site property do not map any global property then return the value
  252. }
  253. var overrideHostToValue = {};
  254. express.forEach(function (_express) {
  255. //console.log("The value of template is: " + _express);
  256. var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
  257. if (this.get('globals').someProperty('name', templateName[index])) {
  258. //console.log("The name of the variable is: " + this.get('content.serviceConfigProperties').findProperty('name', templateName[index]).name);
  259. var globalObj = this.get('globals').findProperty('name', templateName[index]);
  260. var globValue = globalObj.value;
  261. // Hack for templeton.zookeeper.hosts
  262. var preReplaceValue = null;
  263. 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
  264. preReplaceValue = value;
  265. value = this._replaceConfigValues(name, _express, value, globValue);
  266. }
  267. if(globalObj.overrides!=null){
  268. globalObj.overrides.forEach(function(override){
  269. var ov = override.value;
  270. var hostsArray = override.hosts;
  271. hostsArray.forEach(function(host){
  272. if(!(host in overrideHostToValue)){
  273. overrideHostToValue[host] = this._replaceConfigValues(name, _express, preReplaceValue, ov);
  274. }else{
  275. overrideHostToValue[host] = this._replaceConfigValues(name, _express, overrideHostToValue[host], ov);
  276. }
  277. }, this);
  278. }, this);
  279. }
  280. } else {
  281. /*
  282. console.log("ERROR: The variable name is: " + templateName[index]);
  283. console.log("ERROR: mapped config from configMapping file has no corresponding variable in " +
  284. "content.serviceConfigProperties. Two possible reasons for the error could be: 1) The service is not selected. " +
  285. "and/OR 2) The service_config metadata file has no corresponding global var for the site property variable");
  286. */
  287. value = null;
  288. }
  289. }, this);
  290. var valueWithOverrides = {
  291. value: value,
  292. overrides: []
  293. };
  294. var overrideValueToHostMap = {};
  295. if(!jQuery.isEmptyObject(overrideHostToValue)){
  296. for(var host in overrideHostToValue){
  297. var hostVal = overrideHostToValue[host];
  298. if(!(hostVal in overrideValueToHostMap)){
  299. overrideValueToHostMap[hostVal] = [];
  300. }
  301. overrideValueToHostMap[hostVal].push(host);
  302. }
  303. }
  304. for(var val in overrideValueToHostMap){
  305. valueWithOverrides.overrides.push({
  306. value: val,
  307. hosts: overrideValueToHostMap[val]
  308. });
  309. }
  310. return valueWithOverrides;
  311. },
  312. _replaceConfigValues: function (name, express, value, globValue) {
  313. return value.replace(express, globValue);
  314. },
  315. /**
  316. * Load all info about cluster to <code>clusterInfo</code> variable
  317. */
  318. loadClusterInfo: function () {
  319. //Admin name
  320. var admin = this.rawContent.findProperty('config_name', 'Admin');
  321. admin.config_value = App.db.getLoginName();
  322. console.log("STEP8: the value of content cluster name: " + App.db.getLoginName());
  323. if (admin.config_value) {
  324. this.get('clusterInfo').pushObject(Ember.Object.create(admin));
  325. }
  326. // cluster name
  327. var cluster = this.rawContent.findProperty('config_name', 'cluster');
  328. cluster.config_value = this.get('content.cluster.name');
  329. console.log("STEP8: the value of content cluster name: " + this.get('content.cluster.name'));
  330. this.get('clusterInfo').pushObject(Ember.Object.create(cluster));
  331. //hosts
  332. var masterHosts = this.get('content.masterComponentHosts').mapProperty('hostName').uniq();
  333. var slaveHosts = this.get('content.slaveComponentHosts');
  334. var hostObj = [];
  335. slaveHosts.forEach(function (_hosts) {
  336. hostObj = hostObj.concat(_hosts.hosts);
  337. }, this);
  338. slaveHosts = hostObj.mapProperty('hostName').uniq();
  339. var componentHosts = masterHosts.concat(slaveHosts).uniq();
  340. var totalHosts = App.Host.find().mapProperty('hostName').concat(componentHosts).uniq();
  341. var newHostsCount = totalHosts.length - App.Host.find().content.length;
  342. this.set('totalHosts', totalHosts);
  343. var totalHostsObj = this.rawContent.findProperty('config_name', 'hosts');
  344. totalHostsObj.config_value = totalHosts.length + ' (' + newHostsCount + ' new)';
  345. this.get('clusterInfo').pushObject(Ember.Object.create(totalHostsObj));
  346. //repo
  347. if (['addHostController', 'addServiceController'].contains(this.get('content.controllerName'))) {
  348. this.loadRepoInfo();
  349. } else { // from install wizard
  350. var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
  351. var allRepos = [];
  352. var supportedOs = ['redhat5', 'redhat6', 'sles11'];
  353. if (selectedStack && selectedStack.operatingSystems) {
  354. selectedStack.operatingSystems.forEach(function (os) {
  355. if (os.selected && supportedOs.contains(os.osType)) {
  356. allRepos.push(Em.Object.create({
  357. base_url: os.baseUrl,
  358. os_type: Em.I18n.t("installer.step8.repoInfo.osType." + os.osType)
  359. }));
  360. }
  361. }, this);
  362. }
  363. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  364. this.get('clusterInfo').set('repoInfo', allRepos);
  365. }
  366. },
  367. /**
  368. * get the repositories info of HDP from server. Used only in addHost controller.
  369. */
  370. loadRepoInfo: function(){
  371. var nameVersionCombo = App.get('currentStackVersion');
  372. var stackName = nameVersionCombo.split('-')[0];
  373. var stackVersion = nameVersionCombo.split('-')[1];
  374. App.ajax.send({
  375. name: 'cluster.load_repositories',
  376. sender: this,
  377. data: {
  378. stackName: stackName,
  379. stackVersion: stackVersion
  380. },
  381. success: 'loadRepoInfoSuccessCallback',
  382. error: 'loadRepositoriesErrorCallback'
  383. });
  384. },
  385. loadRepoInfoSuccessCallback: function (data) {
  386. var allRepos = [];
  387. var supportedOs = ['redhat5', 'redhat6', 'sles11'];
  388. data.items.forEach(function (item) {
  389. var os = item.repositories[0].Repositories;
  390. if (supportedOs.contains(os.os_type)) {
  391. allRepos.push(Em.Object.create({
  392. base_url: os.base_url,
  393. os_type: Em.I18n.t("installer.step8.repoInfo.osType." + os.os_type)
  394. }));
  395. }
  396. }, this);
  397. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  398. this.get('clusterInfo').set('repoInfo', allRepos);
  399. },
  400. loadRepoInfoErrorCallback: function(request, ajaxOptions, error) {
  401. console.log('Error message is: ' + request.responseText);
  402. var allRepos = [];
  403. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  404. this.get('clusterInfo').set('repoInfo', allRepos);
  405. },
  406. /**
  407. * Load all info about services to <code>services</code> variable
  408. */
  409. loadServices: function () {
  410. var reviewService = this.rawContent.findProperty('config_name', 'services');
  411. this.get('selectedServices').forEach(function (_service) {
  412. console.log('INFO: step8: Name of the service from getService function: ' + _service.serviceName);
  413. var serviceObj = reviewService.config_value.findProperty('service_name', _service.serviceName);
  414. if (serviceObj) {
  415. serviceObj.get('service_components').forEach(function (_component) {
  416. this.assignComponentHosts(_component);
  417. }, this);
  418. this.get('services').pushObject(serviceObj);
  419. }
  420. }, this);
  421. },
  422. assignComponentHosts: function (component) {
  423. var componentValue;
  424. if (component.get('customHandler')) {
  425. this[component.get('customHandler')].call(this, component);
  426. } else {
  427. if (component.get('isMaster')) {
  428. componentValue = this.get('content.masterComponentHosts')
  429. .findProperty('component', component.component_name).hostName;
  430. } else {
  431. var hostsLength = this.get('content.slaveComponentHosts')
  432. .findProperty('componentName', component.component_name)
  433. .hosts.length;
  434. componentValue = hostsLength + Em.I18n.t('installer.step8.host' + ((hostsLength > 1) ? 's' : ''));
  435. }
  436. component.set('component_value', componentValue);
  437. }
  438. },
  439. loadHiveDbValue: function (dbComponent) {
  440. var hiveDb = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'hive_database');
  441. if (hiveDb.value === 'New MySQL Database') {
  442. dbComponent.set('component_value', 'MySQL (New Database)');
  443. } else if(hiveDb.value === 'Existing MySQL Database'){
  444. var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'hive_existing_mysql_database');
  445. dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
  446. } else { // existing oracle database
  447. var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'hive_existing_oracle_database');
  448. dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
  449. }
  450. },
  451. loadHbaseMasterValue: function (hbaseMaster) {
  452. var hbaseHostName = this.get('content.masterComponentHosts').filterProperty('component', hbaseMaster.component_name);
  453. if (hbaseHostName.length == 1) {
  454. hbaseMaster.set('component_value', hbaseHostName[0].hostName);
  455. } else {
  456. hbaseMaster.set('component_value', hbaseHostName[0].hostName + Em.I18n.t('installer.step8.other').format(hbaseHostName.length - 1));
  457. }
  458. },
  459. loadZkServerValue: function (serverComponent) {
  460. var zkHostNames = this.get('content.masterComponentHosts').filterProperty('component', serverComponent.component_name).length;
  461. var hostSuffix;
  462. if (zkHostNames === 1) {
  463. hostSuffix = Em.I18n.t('installer.step8.host');
  464. } else {
  465. hostSuffix = Em.I18n.t('installer.step8.hosts');
  466. }
  467. serverComponent.set('component_value', zkHostNames + ' ' + hostSuffix);
  468. },
  469. loadOozieDbValue: function (dbComponent) {
  470. var oozieDb = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_database');
  471. if (oozieDb.value === 'New Derby Database'){
  472. var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_derby_database');
  473. dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
  474. }/* else if (oozieDb.value === 'New MySQL Database') {
  475. dbComponent.set('component_value', 'MySQL (New Database)');
  476. } */else if(oozieDb.value === 'Existing MySQL Database'){
  477. var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_mysql_database');
  478. dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
  479. } else { // existing oracle database
  480. var db = this.get('wizardController').getDBProperty('serviceConfigProperties').findProperty('name', 'oozie_existing_oracle_database');
  481. dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
  482. }
  483. },
  484. loadNagiosAdminValue: function (nagiosAdmin) {
  485. var config = this.get('content.serviceConfigProperties');
  486. var adminLoginName = config.findProperty('name', 'nagios_web_login');
  487. var adminEmail = config.findProperty('name', 'nagios_contact');
  488. nagiosAdmin.set('component_value', adminLoginName.value + ' / (' + adminEmail.value + ')');
  489. },
  490. /**
  491. * Onclick handler for <code>next</code> button
  492. */
  493. submit: function () {
  494. if (this.get('isSubmitDisabled')) {
  495. return;
  496. }
  497. if ((this.get('content.controllerName') == 'addHostController') && this.get('securityEnabled')) {
  498. var self = this;
  499. App.showConfirmationPopup(function() {
  500. self.submitProceed();
  501. }, Em.I18n.t('installer.step8.securityConfirmationPopupBody'));
  502. }
  503. else {
  504. this.submitProceed();
  505. }
  506. },
  507. /**
  508. * Update configurations for installed services.
  509. *
  510. * @param {Array} configsToUpdate - configs need to update
  511. * @return {*}
  512. */
  513. updateConfigurations: function (configsToUpdate) {
  514. var configurationController = App.router.get('mainServiceInfoConfigsController');
  515. var serviceNames = configsToUpdate.mapProperty('serviceName').uniq();
  516. serviceNames.forEach(function(serviceName) {
  517. var configs = configsToUpdate.filterProperty('serviceName', serviceName);
  518. configurationController.setNewTagNames(configs);
  519. var tagName = configs.objectAt(0).newTagName;
  520. var siteConfigs = configs.filterProperty('id', 'site property');
  521. siteConfigs.mapProperty('filename').uniq().forEach(function(siteName) {
  522. var formattedConfigs = configurationController.createSiteObj(siteName.replace(".xml", ""), tagName, configs.filterProperty('filename', siteName));
  523. configurationController.doPUTClusterConfigurationSite(formattedConfigs);
  524. });
  525. });
  526. },
  527. submitProceed: function() {
  528. this.set('isSubmitDisabled', true);
  529. this.set('isBackBtnDisabled', true);
  530. if (this.get('content.controllerName') == 'addHostController') {
  531. App.router.get('addHostController').setLowerStepsDisable(4);
  532. }
  533. // checkpoint the cluster status on the server so that the user can resume from where they left off
  534. switch (this.get('content.controllerName')) {
  535. case 'installerController':
  536. App.clusterStatus.setClusterStatus({
  537. clusterName: this.get('clusterName'),
  538. clusterState: 'CLUSTER_DEPLOY_PREP_2',
  539. wizardControllerName: this.get('content.controllerName'),
  540. localdb: App.db.data
  541. });
  542. break;
  543. case 'addHostController':
  544. App.clusterStatus.setClusterStatus({
  545. clusterName: this.get('clusterName'),
  546. clusterState: 'ADD_HOSTS_DEPLOY_PREP_2',
  547. wizardControllerName: this.get('content.controllerName'),
  548. localdb: App.db.data
  549. });
  550. break;
  551. case 'addServiceController':
  552. App.clusterStatus.setClusterStatus({
  553. clusterName: this.get('clusterName'),
  554. clusterState: 'ADD_SERVICES_DEPLOY_PREP_2',
  555. wizardControllerName: this.get('content.controllerName'),
  556. localdb: App.db.data
  557. });
  558. break;
  559. default:
  560. break;
  561. }
  562. // delete any existing clusters to start from a clean slate
  563. // before creating a new cluster in install wizard
  564. // TODO: modify for multi-cluster support
  565. if (this.get('content.controllerName') == 'installerController' && (!App.testMode)) {
  566. var clusterNames = this.getExistingClusterNames();
  567. this.deleteClusters(clusterNames);
  568. }
  569. if (this.get('wizardController').getDBProperty('configsToUpdate')) {
  570. this.updateConfigurations(this.get('wizardController').getDBProperty('configsToUpdate'));
  571. }
  572. this.setLocalRepositories();
  573. this.createCluster();
  574. this.createSelectedServices();
  575. if (this.get('content.controllerName') !== 'addHostController') {
  576. this.createConfigurations();
  577. }
  578. this.createComponents();
  579. this.registerHostsToCluster();
  580. if (App.supports.hostOverridesInstaller) {
  581. this.createConfigurationGroups();
  582. }
  583. this.createAllHostComponents();
  584. this.ajaxQueueFinished = function () {
  585. console.log('everything is loaded');
  586. App.router.send('next');
  587. };
  588. this.doNextAjaxCall();
  589. },
  590. /**
  591. * Used in progress bar
  592. */
  593. ajaxQueueLength: function () {
  594. return this.get('ajaxQueue').length;
  595. }.property('ajaxQueue.length'),
  596. /**
  597. * Used in progress bar
  598. */
  599. ajaxQueueLeft: 0,
  600. setAmbariUIDb: function () {
  601. var dbContent = this.get('content.slaveGroupProperties');
  602. var slaveComponentConfig = this.get("slaveComponentConfig");
  603. this.persistKeyValues(slaveComponentConfig.version, dbContent);
  604. this.persistKeyValues('current_version', slaveComponentConfig.version);
  605. },
  606. persistKeyValues: function (key, value) {
  607. var str = "{ '" + key + "' : '" + JSON.stringify(value) + "'}";
  608. var obj = eval("(" + str + ")");
  609. this.ajax({
  610. type: "POST",
  611. url: App.apiPrefix + '/persist',
  612. data: JSON.stringify(obj),
  613. beforeSend: function () {
  614. console.log('BeforeSend: persistKeyValues', obj);
  615. }
  616. });
  617. },
  618. clusterName: function () {
  619. return this.get('content.cluster.name');
  620. }.property('content.cluster.name'),
  621. clusterNames: [],
  622. // returns an array of existing cluster names.
  623. // returns an empty array if there are no existing clusters.
  624. getExistingClusterNames: function () {
  625. var url = App.apiPrefix + '/clusters';
  626. App.ajax.send({
  627. name: 'wizard.step8.existing_cluster_names',
  628. sender: this,
  629. success: 'getExistingClusterNamesSuccessCallBack',
  630. error: 'getExistingClusterNamesErrorCallback'
  631. });
  632. return this.get('clusterNames');
  633. },
  634. getExistingClusterNamesSuccessCallBack: function (data) {
  635. var clusterNames = data.items.mapProperty('Clusters.cluster_name');
  636. console.log("Got existing cluster names: " + clusterNames);
  637. this.set('clusterNames', clusterNames);
  638. },
  639. getExistingClusterNamesErrorCallback: function () {
  640. console.log("Failed to get existing cluster names");
  641. this.set('clusterNames', []);
  642. },
  643. deleteClusters: function (clusterNames) {
  644. clusterNames.forEach(function (clusterName) {
  645. App.ajax.send({
  646. name: 'wizard.step8.delete_cluster',
  647. sender: this,
  648. data: {
  649. name: clusterName
  650. },
  651. success: 'deleteClustersSuccessCallback',
  652. error: 'deleteClustersErrorCallback'
  653. });
  654. }, this);
  655. },
  656. deleteClustersSuccessCallback: function(data, opt, params) {
  657. console.log('DELETE cluster ' + params.name + ' succeeded');
  658. },
  659. deleteClustersErrorCallback: function(request, ajaxOptions, error, opt) {
  660. console.log('DELETE cluster failed');
  661. },
  662. /**
  663. * Updates local repositories for the Ambari server.
  664. */
  665. setLocalRepositories: function () {
  666. if (this.get('content.controllerName') !== 'installerController' || !App.supports.localRepositories) {
  667. return false;
  668. }
  669. var self = this;
  670. var apiUrl = App.get('stack2VersionURL');
  671. var stacks = this.get('content.stacks');
  672. stacks.forEach(function (stack) {
  673. stack.operatingSystems.forEach(function (os) {
  674. if (os.baseUrl !== os.originalBaseUrl) {
  675. console.log("Updating local repository URL from " + os.originalBaseUrl + " -> " + os.baseUrl + ". ", os);
  676. var url = App.apiPrefix + apiUrl + "/operatingSystems/" + os.osType + "/repositories/" + stack.name;
  677. self.ajax({
  678. type: 'PUT',
  679. url: url,
  680. data: JSON.stringify({
  681. "Repositories": {
  682. "base_url": os.baseUrl
  683. }
  684. }),
  685. beforeSend: function () {
  686. console.log("BeforeSend: setLocalRepositories PUT to ", url);
  687. }
  688. });
  689. }
  690. });
  691. });
  692. },
  693. /**
  694. * The following create* functions are called upon submitting Step 8.
  695. */
  696. createCluster: function () {
  697. if (this.get('content.controllerName') !== 'installerController') {
  698. return false;
  699. }
  700. var clusterName = this.get('clusterName');
  701. var url = App.apiPrefix + '/clusters/' + clusterName;
  702. var stackVersion = (this.get('content.installOptions.localRepo')) ? App.currentStackVersion.replace(/(-\d+(\.\d)*)/ig, "Local$&") : App.currentStackVersion;
  703. this.ajax({
  704. type: 'POST',
  705. url: url,
  706. data: JSON.stringify({ "Clusters": {"version": stackVersion }}),
  707. beforeSend: function () {
  708. console.log("BeforeSend: createCluster for " + clusterName);
  709. }
  710. });
  711. },
  712. createSelectedServices: function () {
  713. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services';
  714. var data = this.createServiceData();
  715. var httpMethod = 'POST';
  716. if (!data.length) {
  717. return;
  718. }
  719. this.ajax({
  720. type: httpMethod,
  721. url: url,
  722. data: JSON.stringify(data),
  723. beforeSend: function () {
  724. console.log('BeforeSend: createSelectedServices ', data);
  725. }
  726. });
  727. },
  728. createServiceData: function () {
  729. var services = this.get('selectedServices').mapProperty('serviceName');
  730. var data = [];
  731. services.forEach(function (_service) {
  732. data.pushObject({"ServiceInfo": { "service_name": _service }});
  733. }, this);
  734. return data;
  735. },
  736. createComponents: function () {
  737. var serviceComponents = require('data/service_components');
  738. var services = this.get('selectedServices').mapProperty('serviceName');
  739. services.forEach(function (_service) {
  740. var components = serviceComponents.filterProperty('service_name', _service);
  741. var componentsData = components.map(function (_component) {
  742. return { "ServiceComponentInfo": { "component_name": _component.component_name } };
  743. });
  744. // Service must be specified in terms of a query for creating multiple components at the same time.
  745. // See AMBARI-1018.
  746. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services?ServiceInfo/service_name=' + _service;
  747. var data = {
  748. "components": componentsData
  749. };
  750. this.ajax({
  751. type: 'POST',
  752. url: url,
  753. data: JSON.stringify(data),
  754. beforeSend: function () {
  755. console.log('BeforeSend: createComponents for ' + _service, componentsData);
  756. }
  757. });
  758. }, this);
  759. },
  760. registerHostsToCluster: function () {
  761. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts';
  762. var data = this.createRegisterHostData();
  763. if (data.length == 0) {
  764. return;
  765. }
  766. this.ajax({
  767. type: 'POST',
  768. url: url,
  769. data: JSON.stringify(data),
  770. beforeSend: function () {
  771. console.log('BeforeSend: registerHostsToCluster', data);
  772. }
  773. });
  774. },
  775. createRegisterHostData: function () {
  776. var hosts = this.getRegisteredHosts().filterProperty('isInstalled', false);
  777. if (!hosts.length) {
  778. return [];
  779. }
  780. return hosts.map(function (host) {
  781. return {"Hosts": { "host_name": host.hostName}};
  782. });
  783. },
  784. // TODO: review the code for add hosts / add services scenarios...
  785. createAllHostComponents: function () {
  786. var masterHosts = this.get('content.masterComponentHosts');
  787. var slaveHosts = this.get('content.slaveComponentHosts');
  788. var clients = this.get('content.clients');
  789. // note: masterHosts has 'component' vs slaveHosts has 'componentName'
  790. var masterComponents = masterHosts.mapProperty('component').uniq();
  791. masterComponents.forEach(function (component) {
  792. var hostNames = masterHosts.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
  793. this.registerHostsToComponent(hostNames, component);
  794. }, this);
  795. slaveHosts.forEach(function (_slave) {
  796. if (_slave.componentName !== 'CLIENT') {
  797. var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
  798. this.registerHostsToComponent(hostNames, _slave.componentName);
  799. } else {
  800. clients.forEach(function (_client) {
  801. var hostNames = _slave.hosts.mapProperty('hostName');
  802. switch (_client.component_name) {
  803. case 'HDFS_CLIENT':
  804. // install HDFS_CLIENT on HBASE_MASTER, HBASE_REGIONSERVER, WEBHCAT_SERVER, HISTORYSERVER and OOZIE_SERVER hosts
  805. masterHosts.filterProperty('component', 'HBASE_MASTER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  806. hostNames.pushObject(_masterHost.hostName);
  807. }, this);
  808. masterHosts.filterProperty('component', 'HBASE_REGIONSERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  809. hostNames.pushObject(_masterHost.hostName);
  810. }, this);
  811. masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  812. hostNames.pushObject(_masterHost.hostName);
  813. }, this);
  814. masterHosts.filterProperty('component', 'HISTORYSERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  815. hostNames.pushObject(_masterHost.hostName);
  816. }, this);
  817. masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  818. hostNames.pushObject(_masterHost.hostName);
  819. }, this);
  820. break;
  821. case 'MAPREDUCE_CLIENT':
  822. // install MAPREDUCE_CLIENT on HIVE_SERVER, OOZIE_SERVER, NAGIOS_SERVER, and WEBHCAT_SERVER hosts
  823. masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  824. hostNames.pushObject(_masterHost.hostName);
  825. }, this);
  826. masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  827. hostNames.pushObject(_masterHost.hostName);
  828. }, this);
  829. masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  830. hostNames.pushObject(_masterHost.hostName);
  831. }, this);
  832. masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  833. hostNames.pushObject(_masterHost.hostName);
  834. }, this);
  835. break;
  836. case 'OOZIE_CLIENT':
  837. // install OOZIE_CLIENT on NAGIOS_SERVER host
  838. masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  839. hostNames.pushObject(_masterHost.hostName);
  840. }, this);
  841. break;
  842. case 'ZOOKEEPER_CLIENT':
  843. // install ZOOKEEPER_CLIENT on WEBHCAT_SERVER host
  844. masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  845. hostNames.pushObject(_masterHost.hostName);
  846. }, this);
  847. break;
  848. case 'HIVE_CLIENT':
  849. //install HIVE client on NAGIOS_SERVER host
  850. masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  851. hostNames.pushObject(_masterHost.hostName);
  852. }, this);
  853. masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  854. hostNames.pushObject(_masterHost.hostName);
  855. }, this);
  856. break;
  857. case 'HCAT':
  858. // install HCAT (client) on NAGIOS_SERVER host
  859. masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  860. hostNames.pushObject(_masterHost.hostName);
  861. }, this);
  862. break;
  863. case 'YARN_CLIENT':
  864. // install YARN_CLIENT on NAGIOS_SERVER,HIVE_SERVER,OOZIE_SERVER,WEBHCAT_SERVER host
  865. masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  866. hostNames.pushObject(_masterHost.hostName);
  867. }, this);
  868. masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  869. hostNames.pushObject(_masterHost.hostName);
  870. }, this);
  871. masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  872. hostNames.pushObject(_masterHost.hostName);
  873. }, this);
  874. masterHosts.filterProperty('component', 'WEBHCAT_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  875. hostNames.pushObject(_masterHost.hostName);
  876. }, this);
  877. break;
  878. case 'TEZ_CLIENT':
  879. //install TEZ client on HIVE_SERVER, HIVE_CLIENT hosts.
  880. //HIVE_CLIENT always installed on NAGIOS_SERVER host, so it is the same host with NAGIOS_SERVER and HIVE_CLIENT
  881. masterHosts.filterProperty('component', 'NAGIOS_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  882. hostNames.pushObject(_masterHost.hostName);
  883. }, this);
  884. masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  885. hostNames.pushObject(_masterHost.hostName);
  886. }, this);
  887. break;
  888. }
  889. hostNames = hostNames.uniq();
  890. if (_client.isInstalled) {
  891. //check whether clients are already installed on selected master hosts!!!
  892. var installedHosts = _slave.hosts.filterProperty('isInstalled', true).mapProperty('hostName');
  893. installedHosts.forEach(function (host) {
  894. if (hostNames.contains(host)) {
  895. hostNames.splice(hostNames.indexOf(host), 1);
  896. }
  897. }, this);
  898. }
  899. this.registerHostsToComponent(hostNames, _client.component_name);
  900. }, this);
  901. }
  902. }, this);
  903. // add Ganglia Monitor (Slave) to all hosts if Ganglia service is selected
  904. var gangliaService = this.get('content.services').filterProperty('isSelected', true).findProperty('serviceName', 'GANGLIA');
  905. if (gangliaService) {
  906. var hosts = this.getRegisteredHosts();
  907. if (gangliaService.get('isInstalled')) {
  908. hosts = hosts.filterProperty('isInstalled', false);
  909. }
  910. if (hosts.length) {
  911. this.registerHostsToComponent(hosts.mapProperty('hostName'), 'GANGLIA_MONITOR');
  912. }
  913. }
  914. // add MySQL Server if Hive is selected
  915. var hiveService = this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false).findProperty('serviceName', 'HIVE');
  916. if (hiveService) {
  917. var hiveDb = this.get('content.serviceConfigProperties').findProperty('name', 'hive_database');
  918. if(hiveDb.value == "New MySQL Database") {
  919. this.registerHostsToComponent(masterHosts.filterProperty('component', 'HIVE_SERVER').mapProperty('hostName'), 'MYSQL_SERVER');
  920. }
  921. }
  922. },
  923. registerHostsToComponent: function (hostNames, componentName) {
  924. if (hostNames.length == 0) {
  925. return;
  926. }
  927. var queryStr = '';
  928. hostNames.forEach(function (hostName) {
  929. queryStr += 'Hosts/host_name=' + hostName + '|';
  930. });
  931. //slice off last symbol '|'
  932. queryStr = queryStr.slice(0, -1);
  933. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts';
  934. var data = {
  935. "RequestInfo": {
  936. "query": queryStr
  937. },
  938. "Body": {
  939. "host_components": [
  940. {
  941. "HostRoles": {
  942. "component_name": componentName
  943. }
  944. }
  945. ]
  946. }
  947. };
  948. this.ajax({
  949. type: 'POST',
  950. url: url,
  951. data: JSON.stringify(data)
  952. });
  953. },
  954. createConfigurations: function () {
  955. var selectedServices = this.get('selectedServices');
  956. var coreSiteObject = this.createCoreSiteObj();
  957. if (this.get('content.controllerName') == 'installerController') {
  958. this.get('serviceConfigTags').pushObject(coreSiteObject);
  959. this.get('serviceConfigTags').pushObject(this.createHdfsSiteObj());
  960. this.get('serviceConfigTags').pushObject(this.createLog4jObj('HDFS'));
  961. }
  962. var globalSiteObj = this.createGlobalSiteObj();
  963. if (this.get('content.controllerName') == 'addServiceController') {
  964. globalSiteObj.tag = 'version' + (new Date).getTime();
  965. coreSiteObject.tag = 'version' + (new Date).getTime();
  966. this.get('serviceConfigTags').pushObject(coreSiteObject);
  967. }
  968. this.get('serviceConfigTags').pushObject(globalSiteObj);
  969. if (selectedServices.someProperty('serviceName', 'MAPREDUCE')) {
  970. this.get('serviceConfigTags').pushObject(this.createMrSiteObj());
  971. if (App.supports.capacitySchedulerUi) {
  972. this.get('serviceConfigTags').pushObject(this.createCapacityScheduler());
  973. this.get('serviceConfigTags').pushObject(this.createMapredQueueAcls());
  974. }
  975. this.get('serviceConfigTags').pushObject(this.createLog4jObj('MAPREDUCE'));
  976. }
  977. if (selectedServices.someProperty('serviceName', 'MAPREDUCE2')) {
  978. this.get('serviceConfigTags').pushObject(this.createMrSiteObj());
  979. this.get('serviceConfigTags').pushObject(this.createLog4jObj('MAPREDUCE2'));
  980. }
  981. if (selectedServices.someProperty('serviceName', 'YARN')) {
  982. this.get('serviceConfigTags').pushObject(this.createYarnSiteObj());
  983. this.get('serviceConfigTags').pushObject(this.createCapacityScheduler());
  984. this.get('serviceConfigTags').pushObject(this.createLog4jObj('YARN'));
  985. }
  986. if (selectedServices.someProperty('serviceName', 'HBASE')) {
  987. this.get('serviceConfigTags').pushObject(this.createHbaseSiteObj());
  988. this.get('serviceConfigTags').pushObject(this.createLog4jObj('HBASE'));
  989. }
  990. if (selectedServices.someProperty('serviceName', 'OOZIE')) {
  991. this.get('serviceConfigTags').pushObject(this.createOozieSiteObj());
  992. this.get('serviceConfigTags').pushObject(this.createLog4jObj('OOZIE'));
  993. }
  994. if (selectedServices.someProperty('serviceName', 'HIVE')) {
  995. this.get('serviceConfigTags').pushObject(this.createHiveSiteObj());
  996. this.get('serviceConfigTags').pushObject(this.createLog4jObj('HIVE'));
  997. this.get('serviceConfigTags').pushObject(this.createLog4jObj('HIVE-EXEC'));
  998. }
  999. if (selectedServices.someProperty('serviceName', 'WEBHCAT')) {
  1000. this.get('serviceConfigTags').pushObject(this.createWebHCatSiteObj());
  1001. }
  1002. if (selectedServices.someProperty('serviceName', 'HUE')) {
  1003. this.get('serviceConfigTags').pushObject(this.createHueSiteObj());
  1004. }
  1005. if (selectedServices.someProperty('serviceName', 'PIG')) {
  1006. this.get('serviceConfigTags').pushObject(this.createLog4jObj('PIG'));
  1007. }
  1008. if (selectedServices.someProperty('serviceName', 'FALCON')) {
  1009. this.get('serviceConfigTags').pushObject(this.createFalconStartupSiteObj());
  1010. this.get('serviceConfigTags').pushObject(this.createFalconRuntimeSiteObj());
  1011. }
  1012. if (selectedServices.someProperty('serviceName', 'STORM')) {
  1013. this.get('serviceConfigTags').pushObject(this.createStormSiteObj());
  1014. }
  1015. if (selectedServices.someProperty('serviceName', 'TEZ')) {
  1016. this.get('serviceConfigTags').pushObject(this.createTezSiteObj());
  1017. }
  1018. if (selectedServices.someProperty('serviceName', 'ZOOKEEPER')) {
  1019. this.get('serviceConfigTags').pushObject(this.createZooCfgObj());
  1020. this.get('serviceConfigTags').pushObject(this.createLog4jObj('ZOOKEEPER'));
  1021. }
  1022. this.applyConfigurationsToCluster();
  1023. },
  1024. applyConfigurationsToCluster: function() {
  1025. var clusterUrl = App.apiPrefix + '/clusters/' + this.get('clusterName');
  1026. var configData = [];
  1027. this.get('serviceConfigTags').forEach(function (_serviceConfig) {
  1028. var Clusters = {
  1029. Clusters: {
  1030. desired_config: {
  1031. type: _serviceConfig.type,
  1032. tag: _serviceConfig.tag,
  1033. properties: _serviceConfig.properties
  1034. }
  1035. }
  1036. };
  1037. configData.pushObject(JSON.stringify(Clusters));
  1038. }, this);
  1039. var data = {
  1040. configData: '[' + configData.toString() + ']'
  1041. };
  1042. console.debug("applyConfigurationsToCluster(Step8): Applying to URL", clusterUrl, " Data:", data.configData);
  1043. this.ajax({
  1044. type: 'PUT',
  1045. url: clusterUrl,
  1046. data: data.configData,
  1047. beforeSend: function () {
  1048. console.log("BeforeSend: Updating cluster config");
  1049. }
  1050. });
  1051. },
  1052. createConfigurationGroups: function () {
  1053. var configGroups = this.get('content.configGroups').filterProperty('isDefault', false);
  1054. var clusterName = this.get('clusterName');
  1055. var sendData = [];
  1056. var updateData = [];
  1057. var serviceConfigController = App.router.get('mainServiceInfoConfigsController');
  1058. var timeTag = (new Date).getTime();
  1059. var groupsToDelete = App.router.get(this.get('content.controllerName')).getDBProperty('groupsToDelete');
  1060. if (groupsToDelete && groupsToDelete.length > 0) {
  1061. this.removeInstalledServicesConfigurationGroups(groupsToDelete);
  1062. }
  1063. configGroups.forEach(function (configGroup) {
  1064. var groupConfigs = [];
  1065. var groupData = {
  1066. "cluster_name": clusterName,
  1067. "group_name": configGroup.name,
  1068. "tag": configGroup.service.id,
  1069. "description": configGroup.description,
  1070. "hosts": [],
  1071. "desired_configs": []
  1072. };
  1073. configGroup.hosts.forEach(function (hostName) {
  1074. groupData.hosts.push({"host_name": hostName});
  1075. });
  1076. //wrap properties into Em.Object to make them compatible with buildGroupDesiredConfigs method
  1077. configGroup.properties.forEach(function (property) {
  1078. groupConfigs.push(Em.Object.create(property));
  1079. });
  1080. groupData.desired_configs = serviceConfigController.buildGroupDesiredConfigs.call(serviceConfigController, groupConfigs, timeTag);
  1081. // check for group from installed service
  1082. if (configGroup.isForUpdate === true) {
  1083. // if group is a new one, create it
  1084. if (!configGroup.id) {
  1085. sendData.push({"ConfigGroup": groupData});
  1086. } else {
  1087. // update an existing group
  1088. groupData.id = configGroup.id;
  1089. updateData.push({"ConfigGroup": groupData});
  1090. }
  1091. } else {
  1092. sendData.push({"ConfigGroup": groupData});
  1093. }
  1094. //each group should have unique tag to prevent overriding configs from common sites
  1095. timeTag++;
  1096. }, this);
  1097. if (sendData.length > 0) {
  1098. this.applyConfigurationGroups(sendData);
  1099. }
  1100. if (updateData.length > 0) {
  1101. this.applyInstalledServicesConfigurationGroup(updateData);
  1102. }
  1103. },
  1104. applyConfigurationGroups: function (sendData) {
  1105. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/config_groups';
  1106. this.ajax({
  1107. type: 'POST',
  1108. url: url,
  1109. data: JSON.stringify(sendData)
  1110. });
  1111. },
  1112. applyInstalledServicesConfigurationGroup: function (updateData) {
  1113. updateData.forEach(function(item) {
  1114. App.router.get('mainServiceInfoConfigsController').putConfigGroupChanges(item);
  1115. });
  1116. },
  1117. removeInstalledServicesConfigurationGroups: function(groupsToDelete) {
  1118. groupsToDelete.forEach(function(item) {
  1119. App.config.deleteConfigGroup(Em.Object.create(item));
  1120. });
  1121. },
  1122. createGlobalSiteObj: function () {
  1123. var globalSiteProperties = {};
  1124. var globalSiteObj = this.get('globals');
  1125. var isGLUSTERFSSelected = this.get('selectedServices').someProperty('serviceName', 'GLUSTERFS');
  1126. // screen out the GLUSTERFS-specific global config entries when they are not required
  1127. if (!isGLUSTERFSSelected) {
  1128. globalSiteObj = globalSiteObj.filter(function(_config) {
  1129. return _config.name.indexOf("fs_glusterfs") < 0;
  1130. });
  1131. }
  1132. globalSiteObj.forEach(function (_globalSiteObj) {
  1133. var heapsizeException = ['hadoop_heapsize','yarn_heapsize','nodemanager_heapsize','resourcemanager_heapsize', 'apptimelineserver_heapsize'];
  1134. // do not pass any globals whose name ends with _host or _hosts
  1135. if (_globalSiteObj.isRequiredByAgent !== false) {
  1136. // append "m" to JVM memory options except for hadoop_heapsize
  1137. if (/_heapsize|_newsize|_maxnewsize$/.test(_globalSiteObj.name) && !heapsizeException.contains(_globalSiteObj.name)) {
  1138. globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value + "m";
  1139. } else {
  1140. globalSiteProperties[_globalSiteObj.name] = App.config.escapeXMLCharacters(_globalSiteObj.value);
  1141. }
  1142. }
  1143. }, this);
  1144. // we don't expose gmond_user to the user; it needs to be the same as gmetad_user
  1145. globalSiteProperties['gmond_user'] = globalSiteProperties['gmetad_user'];
  1146. return {"type": "global", "tag": "version1", "properties": globalSiteProperties};
  1147. },
  1148. createCoreSiteObj: function () {
  1149. var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml');
  1150. var coreSiteProperties = {};
  1151. // hadoop.proxyuser.oozie.hosts needs to be skipped if oozie is not selected
  1152. var isOozieSelected = this.get('selectedServices').someProperty('serviceName', 'OOZIE');
  1153. var oozieUser = this.get('globals').someProperty('name', 'oozie_user') ? this.get('globals').findProperty('name', 'oozie_user').value : null;
  1154. var isHiveSelected = this.get('selectedServices').someProperty('serviceName', 'HIVE');
  1155. var hiveUser = this.get('globals').someProperty('name', 'hive_user') ? this.get('globals').findProperty('name', 'hive_user').value : null;
  1156. var isHcatSelected = this.get('selectedServices').someProperty('serviceName', 'WEBHCAT');
  1157. var hcatUser = this.get('globals').someProperty('name', 'hcat_user') ? this.get('globals').findProperty('name', 'hcat_user').value : null;
  1158. var isGLUSTERFSSelected = this.get('selectedServices').someProperty('serviceName', 'GLUSTERFS');
  1159. // screen out the GLUSTERFS-specific core-site.xml entries when they are not needed
  1160. if (!isGLUSTERFSSelected) {
  1161. coreSiteObj = coreSiteObj.filter(function(_config) {
  1162. return _config.name.indexOf("fs.glusterfs") < 0;
  1163. });
  1164. }
  1165. coreSiteObj.forEach(function (_coreSiteObj) {
  1166. if ((isOozieSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + oozieUser + '.groups')) && (isHiveSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hiveUser + '.groups')) && (isHcatSelected || (_coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.hosts' && _coreSiteObj.name != 'hadoop.proxyuser.' + hcatUser + '.groups'))) {
  1167. coreSiteProperties[_coreSiteObj.name] = App.config.escapeXMLCharacters(_coreSiteObj.value);
  1168. }
  1169. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.default.name") {
  1170. coreSiteProperties[_coreSiteObj.name] = this.get('globals').someProperty('name', 'fs_glusterfs_default_name') ? App.config.escapeXMLCharacters(this.get('globals').findProperty('name', 'fs_glusterfs_default_name').value) : null;
  1171. }
  1172. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.defaultFS") {
  1173. coreSiteProperties[_coreSiteObj.name] = this.get('globals').someProperty('name', 'glusterfs_defaultFS_name') ? App.config.escapeXMLCharacters(this.get('globals').findProperty('name', 'glusterfs_defaultFS_name').value) : null;
  1174. }
  1175. console.log("STEP*: name of the property is: " + _coreSiteObj.name);
  1176. console.log("STEP8: value of the property is: " + _coreSiteObj.value);
  1177. }, this);
  1178. return {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
  1179. },
  1180. createHdfsSiteObj: function () {
  1181. var hdfsSiteObj = this.get('configs').filterProperty('filename', 'hdfs-site.xml');
  1182. var hdfsProperties = {};
  1183. hdfsSiteObj.forEach(function (_configProperty) {
  1184. hdfsProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1185. console.log("STEP*: name of the property is: " + _configProperty.name);
  1186. console.log("STEP8: value of the property is: " + _configProperty.value);
  1187. }, this);
  1188. return {"type": "hdfs-site", "tag": "version1", "properties": hdfsProperties };
  1189. },
  1190. createLog4jObj: function (serviceName) {
  1191. var fileName = serviceName.toLowerCase();
  1192. var Log4jObj = this.get('configs').filterProperty('filename', fileName + '-log4j.xml');
  1193. var Log4jProperties = {};
  1194. Log4jObj.forEach(function (_configProperty) {
  1195. Log4jProperties[_configProperty.name] = _configProperty.value;
  1196. console.log("STEP*: name of the property is: " + _configProperty.name);
  1197. console.log("STEP8: value of the property is: " + _configProperty.value);
  1198. }, this);
  1199. return {"type": fileName + "-log4j", "tag": "version1", "properties": Log4jProperties };
  1200. },
  1201. createHueSiteObj: function () {
  1202. var hueSiteObj = this.get('configs').filterProperty('filename', 'hue-site.xml');
  1203. var hueProperties = {};
  1204. hueSiteObj.forEach(function (_configProperty) {
  1205. hueProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1206. console.log("STEP*: name of the property is: " + _configProperty.name);
  1207. console.log("STEP8: value of the property is: " + _configProperty.value);
  1208. }, this);
  1209. return {"type": "hue-site", "tag": "version1", "properties": hueProperties };
  1210. },
  1211. createMrSiteObj: function () {
  1212. var configs = this.get('configs').filterProperty('filename', 'mapred-site.xml');
  1213. var mrProperties = {};
  1214. configs.forEach(function (_configProperty) {
  1215. mrProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1216. console.log("STEP*: name of the property is: " + _configProperty.name);
  1217. console.log("STEP8: value of the property is: " + _configProperty.value);
  1218. }, this);
  1219. return {type: 'mapred-site', tag: 'version1', properties: mrProperties};
  1220. },
  1221. createYarnSiteObj: function () {
  1222. var configs = this.get('configs').filterProperty('filename', 'yarn-site.xml');
  1223. var mrProperties = {};
  1224. configs.forEach(function (_configProperty) {
  1225. mrProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1226. console.log("STEP*: name of the property is: " + _configProperty.name);
  1227. console.log("STEP8: value of the property is: " + _configProperty.value);
  1228. }, this);
  1229. return {type: 'yarn-site', tag: 'version1', properties: mrProperties};
  1230. },
  1231. createCapacityScheduler: function () {
  1232. var configs = this.get('configs').filterProperty('filename', 'capacity-scheduler.xml');
  1233. var csProperties = {};
  1234. configs.forEach(function (_configProperty) {
  1235. csProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1236. console.log("STEP*: name of the property is: " + _configProperty.name);
  1237. console.log("STEP8: value of the property is: " + _configProperty.value);
  1238. }, this);
  1239. return {type: 'capacity-scheduler', tag: 'version1', properties: csProperties};
  1240. },
  1241. createMapredQueueAcls: function () {
  1242. var configs = this.get('configs').filterProperty('filename', 'mapred-queue-acls.xml');
  1243. var mqProperties = {};
  1244. configs.forEach(function (_configProperty) {
  1245. mqProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1246. console.log("STEP*: name of the property is: " + _configProperty.name);
  1247. console.log("STEP8: value of the property is: " + _configProperty.value);
  1248. }, this);
  1249. return {type: 'mapred-queue-acls', tag: 'version1', properties: mqProperties};
  1250. },
  1251. createHbaseSiteObj: function () {
  1252. var configs = this.get('configs').filterProperty('filename', 'hbase-site.xml');
  1253. var hbaseProperties = {};
  1254. configs.forEach(function (_configProperty) {
  1255. hbaseProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1256. }, this);
  1257. return {type: 'hbase-site', tag: 'version1', properties: hbaseProperties};
  1258. },
  1259. createOozieSiteObj: function () {
  1260. var configs = this.get('configs').filterProperty('filename', 'oozie-site.xml');
  1261. var oozieProperties = {};
  1262. configs.forEach(function (_configProperty) {
  1263. oozieProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1264. }, this);
  1265. return {type: 'oozie-site', tag: 'version1', properties: oozieProperties};
  1266. },
  1267. createHiveSiteObj: function () {
  1268. var configs = this.get('configs').filterProperty('filename', 'hive-site.xml');
  1269. var hiveProperties = {};
  1270. configs.forEach(function (_configProperty) {
  1271. hiveProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1272. }, this);
  1273. return {type: 'hive-site', tag: 'version1', properties: hiveProperties};
  1274. },
  1275. createWebHCatSiteObj: function () {
  1276. var configs = this.get('configs').filterProperty('filename', 'webhcat-site.xml');
  1277. var webHCatProperties = {};
  1278. configs.forEach(function (_configProperty) {
  1279. webHCatProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1280. }, this);
  1281. return {type: 'webhcat-site', tag: 'version1', properties: webHCatProperties};
  1282. },
  1283. createZooCfgObj: function () {
  1284. var configs = this.get('configs').filterProperty('filename', 'zoo.cfg');
  1285. var csProperties = {};
  1286. configs.forEach(function (_configProperty) {
  1287. csProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1288. }, this);
  1289. return {type: 'zoo.cfg', tag: 'version1', properties: csProperties};
  1290. },
  1291. createStormSiteObj: function () {
  1292. var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
  1293. var stormProperties = {};
  1294. var specialProperties = ["storm.zookeeper.servers", "nimbus.childopts", "supervisor.childopts", "worker.childopts"];
  1295. configs.forEach(function (_configProperty) {
  1296. if (specialProperties.contains(_configProperty.name)) {
  1297. if (_configProperty.name == "storm.zookeeper.servers") {
  1298. stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "'");
  1299. } else {
  1300. stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g,"");
  1301. }
  1302. } else {
  1303. stormProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1304. }
  1305. }, this);
  1306. return {type: 'storm-site', tag: 'version1', properties: stormProperties};
  1307. },
  1308. createTezSiteObj: function () {
  1309. var configs = this.get('configs').filterProperty('filename', 'tez-site.xml');
  1310. var tezProperty = {};
  1311. configs.forEach(function (_configProperty) {
  1312. tezProperty[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1313. }, this);
  1314. return {type: 'tez-site', tag: 'version1', properties: tezProperty};
  1315. },
  1316. createFalconStartupSiteObj: function () {
  1317. var configs = this.get('configs').filterProperty('filename', 'falcon-startup.properties.xml');
  1318. var falconStartupProperties = {};
  1319. configs.forEach(function (_configProperty) {
  1320. falconStartupProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1321. }, this);
  1322. return {type: 'falcon-startup.properties', tag: 'version1', properties: falconStartupProperties};
  1323. },
  1324. createFalconRuntimeSiteObj: function () {
  1325. var configs = this.get('configs').filterProperty('filename', 'falcon-runtime.properties.xml');
  1326. var falconRuntimeProperties = {};
  1327. configs.forEach(function (_configProperty) {
  1328. falconRuntimeProperties[_configProperty.name] = App.config.escapeXMLCharacters(_configProperty.value);
  1329. }, this);
  1330. return {type: 'falcon-runtime.properties', tag: 'version1', properties: falconRuntimeProperties};
  1331. },
  1332. ajaxQueueFinished: function () {
  1333. //do something
  1334. },
  1335. doNextAjaxCall: function () {
  1336. if (this.get('ajaxBusy')) {
  1337. return;
  1338. }
  1339. var queue = this.get('ajaxQueue');
  1340. if (!queue.length) {
  1341. this.ajaxQueueFinished();
  1342. return;
  1343. }
  1344. var first = queue[0];
  1345. this.set('ajaxQueue', queue.slice(1));
  1346. this.set('ajaxQueueLeft', this.get('ajaxQueue').length);
  1347. this.set('ajaxBusy', true);
  1348. $.ajax(first);
  1349. },
  1350. /**
  1351. * We need to do a lot of ajax calls async in special order. To do this,
  1352. * generate array of ajax objects and then send requests step by step. All
  1353. * ajax objects are stored in <code>ajaxQueue</code>
  1354. *
  1355. * @param params
  1356. */
  1357. ajax: function (params) {
  1358. if (App.testMode) return;
  1359. var self = this;
  1360. params = jQuery.extend({
  1361. async: true,
  1362. dataType: 'text',
  1363. statusCode: require('data/statusCodes'),
  1364. timeout: App.timeout,
  1365. error: function (request, ajaxOptions, error) {
  1366. console.log('Step8: In Error ');
  1367. // console.log('Step8: Error message is: ' + request.responseText);
  1368. },
  1369. success: function (data) {
  1370. console.log("TRACE: STep8 -> In success function");
  1371. }
  1372. }, params);
  1373. var success = params.success;
  1374. var error = params.error;
  1375. params.success = function () {
  1376. if (success) {
  1377. success();
  1378. }
  1379. self.set('ajaxBusy', false);
  1380. self.doNextAjaxCall();
  1381. };
  1382. params.error = function (xhr, status, error) {
  1383. var responseText = JSON.parse(xhr.responseText);
  1384. var controller = App.router.get(App.clusterStatus.wizardControllerName);
  1385. controller.registerErrPopup(Em.I18n.t('common.error'), responseText.message);
  1386. self.set('hasErrorOccurred', true);
  1387. // an error will break the ajax call chain and allow submission again
  1388. self.set('isSubmitDisabled', false);
  1389. self.set('isBackBtnDisabled', false);
  1390. App.router.get(self.get('content.controllerName')).setStepsEnable();
  1391. self.get('ajaxQueue').clear();
  1392. self.set('ajaxBusy', false);
  1393. };
  1394. this.get('ajaxQueue').pushObject(params);
  1395. }
  1396. });