step8_controller.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187
  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. App.WizardStep8Controller = Em.Controller.extend({
  20. name: 'wizardStep8Controller',
  21. rawContent: require('data/review_configs'),
  22. totalHosts: [],
  23. clusterInfo: [],
  24. services: [],
  25. configs: [],
  26. globals: [],
  27. configMapping: require('data/config_mapping'),
  28. slaveComponentConfig: null,
  29. isSubmitDisabled: false,
  30. selectedServices: function () {
  31. return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false);
  32. }.property('content.services').cacheable(),
  33. clearStep: function () {
  34. this.get('services').clear();
  35. this.get('configs').clear();
  36. this.get('globals').clear();
  37. this.get('clusterInfo').clear();
  38. },
  39. loadStep: function () {
  40. console.log("TRACE: Loading step8: Review Page");
  41. this.clearStep();
  42. this.loadGlobals();
  43. this.loadConfigs();
  44. this.setCustomConfigs();
  45. this.loadClusterInfo();
  46. this.loadSlaveConfiguration();
  47. this.loadServices();
  48. },
  49. loadSlaveConfiguration: function () {
  50. var slaveComponentConfig = this.convertSlaveConfig(this.get('content.slaveGroupProperties'));
  51. this.set("slaveComponentConfig", slaveComponentConfig);
  52. },
  53. convertSlaveConfig: function (slaveContent) {
  54. var dest = {
  55. "version": "1.0",
  56. "components": [
  57. ]
  58. };
  59. slaveContent.forEach(function (_slaveContent) {
  60. var newComponent = {};
  61. newComponent.componentName = _slaveContent.componentName;
  62. newComponent.serviceName = this.getServiceName(newComponent.componentName);
  63. newComponent.groups = [];
  64. _slaveContent.groups.forEach(function (_group) {
  65. var newGroup = {};
  66. newGroup.groupName = _group.name;
  67. newGroup.configVersion = "1.0"; // TODO : every time a new version should be generated
  68. newGroup.hostNames = _slaveContent.hosts.filterProperty("group", newGroup.groupName);
  69. newGroup.properties = _group.properties;
  70. if (!Ember.empty(newGroup.hostNames)) {
  71. newComponent.groups.push(newGroup);
  72. }
  73. }, this);
  74. dest.components.push(newComponent);
  75. }, this);
  76. return dest;
  77. },
  78. getServiceName: function (componentName) {
  79. var serviceName = null
  80. switch (componentName) {
  81. case 'DATANODE':
  82. serviceName = 'HDFS';
  83. break;
  84. case 'TASKTRACKER':
  85. serviceName = 'MAPREDUCE';
  86. break;
  87. case 'HBASE_REGIONSERVER':
  88. serviceName = 'HBASE';
  89. break;
  90. default:
  91. serviceName = null;
  92. }
  93. return serviceName;
  94. },
  95. loadGlobals: function () {
  96. var globals = this.get('content.serviceConfigProperties').filterProperty('id', 'puppet var');
  97. if (globals.someProperty('name', 'hive_database')) {
  98. //TODO: Hive host depends on the type of db selected. Change puppet variable name if postgress is not the default db
  99. var hiveDb = globals.findProperty('name', 'hive_database');
  100. if (hiveDb.value === 'New PostgreSQL Database') {
  101. globals.findProperty('name', 'hive_ambari_host').name = 'hive_mysql_host';
  102. globals = globals.without(globals.findProperty('name', 'hive_existing_host'));
  103. globals = globals.without(globals.findProperty('name', 'hive_existing_database'));
  104. } else {
  105. globals.findProperty('name', 'hive_existing_host').name = 'hive_mysql_host';
  106. globals = globals.without(globals.findProperty('name', 'hive_ambari_host'));
  107. globals = globals.without(globals.findProperty('name', 'hive_ambari_database'));
  108. }
  109. }
  110. this.set('globals', globals);
  111. },
  112. loadConfigs: function () {
  113. var storedConfigs = this.get('content.serviceConfigProperties').filterProperty('id', 'site property').filterProperty('value');
  114. var uiConfigs = this.loadUiSideConfigs();
  115. this.set('configs', storedConfigs.concat(uiConfigs));
  116. },
  117. loadUiSideConfigs: function () {
  118. var uiConfig = [];
  119. var configs = this.get('configMapping').filterProperty('foreignKey', null);
  120. configs.forEach(function (_config) {
  121. var value = this.getGlobConfigValue(_config.templateName, _config.value);
  122. uiConfig.pushObject({
  123. "id": "site property",
  124. "name": _config.name,
  125. "value": value,
  126. "filename": _config.filename
  127. });
  128. }, this);
  129. var dependentConfig = this.get('configMapping').filterProperty('foreignKey');
  130. dependentConfig.forEach(function (_config) {
  131. this.setConfigValue(uiConfig, _config);
  132. uiConfig.pushObject({
  133. "id": "site property",
  134. "name": _config.name,
  135. "value": _config.value,
  136. "filename": _config.filename
  137. });
  138. }, this);
  139. return uiConfig;
  140. },
  141. getRegisteredHosts: function () {
  142. var allHosts = this.get('content.hostsInfo');
  143. var hosts = [];
  144. for (var hostName in allHosts) {
  145. if (allHosts[hostName].bootStatus == 'REGISTERED') {
  146. allHosts[hostName].hostName = allHosts[hostName].name;
  147. hosts.pushObject(allHosts[hostName]);
  148. }
  149. }
  150. return hosts;
  151. },
  152. /**
  153. * Set all site property that are derived from other puppet-variable
  154. */
  155. getGlobConfigValue: function (templateName, expression) {
  156. var express = expression.match(/<(.*?)>/g);
  157. var value = expression;
  158. if (express == null) {
  159. return expression;
  160. }
  161. express.forEach(function (_express) {
  162. //console.log("The value of template is: " + _express);
  163. var index = parseInt(_express.match(/\[([\d]*)(?=\])/)[1]);
  164. if (this.get('globals').someProperty('name', templateName[index])) {
  165. //console.log("The name of the variable is: " + this.get('content.serviceConfigProperties').findProperty('name', templateName[index]).name);
  166. var globValue = this.get('globals').findProperty('name', templateName[index]).value;
  167. value = value.replace(_express, globValue);
  168. } else {
  169. /*
  170. console.log("ERROR: The variable name is: " + templateName[index]);
  171. console.log("ERROR: mapped config from configMapping file has no corresponding variable in " +
  172. "content.serviceConfigProperties. Two possible reasons for the error could be: 1) The service is not selected. " +
  173. "and/OR 2) The service_config metadata file has no corresponding global var for the site property variable");
  174. */
  175. value = null;
  176. }
  177. }, this);
  178. return value;
  179. },
  180. /**
  181. * Set all site property that are derived from other site-properties
  182. */
  183. setConfigValue: function (uiConfig, config) {
  184. var fkValue = config.value.match(/<(foreignKey.*?)>/g);
  185. if (fkValue) {
  186. fkValue.forEach(function (_fkValue) {
  187. var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
  188. if (uiConfig.someProperty('name', config.foreignKey[index])) {
  189. var globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
  190. config.value = config.value.replace(_fkValue, globalValue);
  191. } else if (this.get('content.serviceConfigProperties').someProperty('name', config.foreignKey[index])) {
  192. var globalValue;
  193. if (this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value === '') {
  194. globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).defaultValue;
  195. } else {
  196. globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value;
  197. }
  198. config.value = config.value.replace(_fkValue, globalValue);
  199. }
  200. }, this);
  201. }
  202. if (fkValue = config.name.match(/<(foreignKey.*?)>/g)) {
  203. fkValue.forEach(function (_fkValue) {
  204. var index = parseInt(_fkValue.match(/\[([\d]*)(?=\])/)[1]);
  205. if (uiConfig.someProperty('name', config.foreignKey[index])) {
  206. var globalValue = uiConfig.findProperty('name', config.foreignKey[index]).value;
  207. config.name = config.name.replace(_fkValue, globalValue);
  208. } else if (this.get('content.serviceConfigProperties').someProperty('name', config.foreignKey[index])) {
  209. var globalValue;
  210. if (this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value === '') {
  211. globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).defaultValue;
  212. } else {
  213. globalValue = this.get('content.serviceConfigProperties').findProperty('name', config.foreignKey[index]).value;
  214. }
  215. config.name = config.name.replace(_fkValue, globalValue);
  216. }
  217. }, this);
  218. }
  219. //For properties in the configMapping file having foreignKey and templateName properties.
  220. var templateValue = config.value.match(/<(templateName.*?)>/g);
  221. if (templateValue) {
  222. templateValue.forEach(function (_value) {
  223. var index = parseInt(_value.match(/\[([\d]*)(?=\])/)[1]);
  224. if (this.get('globals').someProperty('name', config.templateName[index])) {
  225. var globalValue = this.get('globals').findProperty('name', config.templateName[index]).value;
  226. config.value = config.value.replace(_value, globalValue);
  227. }
  228. }, this);
  229. }
  230. },
  231. /**
  232. * override site properties with the entered key-value pair in *-site.xml
  233. */
  234. setCustomConfigs: function () {
  235. var site = this.get('content.serviceConfigProperties').filterProperty('id', 'conf-site');
  236. site.forEach(function (_site) {
  237. var keyValue = _site.value.split(/\n+/);
  238. if (keyValue) {
  239. keyValue.forEach(function (_keyValue) {
  240. console.log("The value of the keyValue is: " + _keyValue.trim());
  241. _keyValue = _keyValue.trim();
  242. var key = _keyValue.match(/(.+)=/);
  243. var value = _keyValue.match(/=(.*)/);
  244. if (key) {
  245. this.setSiteProperty(key[1], value[1], _site.filename);
  246. }
  247. }, this);
  248. }
  249. }, this);
  250. },
  251. /**
  252. * Set property of the site variable
  253. */
  254. setSiteProperty: function (key, value, filename) {
  255. if (this.get('configs').someProperty('name', key)) {
  256. this.get('configs').findProperty('name', key).value = value;
  257. } else {
  258. this.get('configs').pushObject({
  259. "id": "site property",
  260. "name": key,
  261. "value": value,
  262. "filename": filename
  263. });
  264. }
  265. },
  266. /**
  267. * Load all info about cluster to <code>clusterInfo</code> variable
  268. */
  269. loadClusterInfo: function () {
  270. // cluster name
  271. var cluster = this.rawContent.findProperty('config_name', 'cluster');
  272. cluster.config_value = this.get('content.cluster.name');
  273. console.log("STEP8: the value of content cluster name: " + this.get('content.cluster.name'));
  274. this.get('clusterInfo').pushObject(Ember.Object.create(cluster));
  275. //hosts
  276. var masterHosts = this.get('content.masterComponentHosts').mapProperty('hostName').uniq();
  277. var slaveHosts = this.get('content.slaveComponentHosts');
  278. var hostObj = [];
  279. slaveHosts.forEach(function (_hosts) {
  280. hostObj = hostObj.concat(_hosts.hosts);
  281. }, this);
  282. slaveHosts = hostObj.mapProperty('hostName').uniq();
  283. var totalHosts = masterHosts.concat(slaveHosts).uniq();
  284. this.set('totalHosts', totalHosts);
  285. var totalHostsObj = this.rawContent.findProperty('config_name', 'hosts');
  286. totalHostsObj.config_value = totalHosts.length;
  287. this.get('clusterInfo').pushObject(Ember.Object.create(totalHostsObj));
  288. //repo
  289. var repoOption = this.get('content.hosts.localRepo');
  290. var repoObj = this.rawContent.findProperty('config_name', 'Repo');
  291. if (repoOption) {
  292. repoObj.config_value = 'Yes';
  293. } else {
  294. repoObj.config_value = 'No';
  295. }
  296. this.get('clusterInfo').pushObject(Ember.Object.create(repoObj));
  297. },
  298. /**
  299. * Load all info about services to <code>services</code> variable
  300. */
  301. loadServices: function () {
  302. var selectedServices = this.get('selectedServices');
  303. this.set('services', selectedServices.mapProperty('serviceName'));
  304. selectedServices.forEach(function (_service) {
  305. console.log('INFO: step8: Name of the service from getService function: ' + _service.serviceName);
  306. var reviewService = this.rawContent.findProperty('config_name', 'services');
  307. var serviceObj = reviewService.config_value.findProperty('service_name', _service.serviceName);
  308. if (serviceObj) {
  309. switch (serviceObj.service_name) {
  310. case 'HDFS':
  311. this.loadHDFS(serviceObj);
  312. break;
  313. case 'MAPREDUCE':
  314. this.loadMapReduce(serviceObj);
  315. break;
  316. case 'HIVE':
  317. this.loadHive(serviceObj);
  318. break;
  319. case 'HBASE':
  320. this.loadHbase(serviceObj);
  321. break;
  322. case 'ZOOKEEPER':
  323. this.loadZk(serviceObj);
  324. break;
  325. case 'OOZIE':
  326. this.loadOozie(serviceObj);
  327. break;
  328. case 'NAGIOS':
  329. this.loadNagios(serviceObj);
  330. break;
  331. case 'GANGLIA':
  332. this.loadGanglia(serviceObj);
  333. break;
  334. case 'HCATALOG':
  335. break;
  336. default:
  337. }
  338. }
  339. }, this);
  340. },
  341. /**
  342. * load all info about HDFS service
  343. * @param hdfsObj
  344. */
  345. loadHDFS: function (hdfsObj) {
  346. hdfsObj.get('service_components').forEach(function (_component) {
  347. switch (_component.get('display_name')) {
  348. case 'NameNode':
  349. this.loadNnValue(_component);
  350. break;
  351. case 'SecondaryNameNode':
  352. this.loadSnnValue(_component);
  353. break;
  354. case 'DataNodes':
  355. this.loadDnValue(_component);
  356. break;
  357. default:
  358. }
  359. }, this);
  360. //var
  361. this.get('services').pushObject(hdfsObj);
  362. },
  363. loadNnValue: function (nnComponent) {
  364. var nnHostName = this.get('content.masterComponentHosts').findProperty('display_name', nnComponent.display_name);
  365. nnComponent.set('component_value', nnHostName.hostName);
  366. },
  367. loadSnnValue: function (snnComponent) {
  368. var snnHostName = this.get('content.masterComponentHosts').findProperty('display_name', 'SNameNode');
  369. snnComponent.set('component_value', snnHostName.hostName);
  370. },
  371. loadDnValue: function (dnComponent) {
  372. var dnHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'DataNode');
  373. var totalDnHosts = dnHosts.hosts.length;
  374. var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName','DATANODE').groups.length;
  375. var groupLabel;
  376. if (totalGroups == 1) {
  377. groupLabel = 'group';
  378. } else {
  379. groupLabel = 'groups';
  380. }
  381. dnComponent.set('component_value', totalDnHosts + ' hosts ' + '(' + totalGroups + ' ' + groupLabel + ')');
  382. },
  383. /**
  384. * Load all info about mapReduce service
  385. * @param mrObj
  386. */
  387. loadMapReduce: function (mrObj) {
  388. mrObj.get('service_components').forEach(function (_component) {
  389. switch (_component.get('display_name')) {
  390. case 'JobTracker':
  391. this.loadJtValue(_component);
  392. break;
  393. case 'TaskTrackers':
  394. this.loadTtValue(_component);
  395. break;
  396. default:
  397. }
  398. }, this);
  399. this.get('services').pushObject(mrObj);
  400. },
  401. loadJtValue: function (jtComponent) {
  402. var jtHostName = this.get('content.masterComponentHosts').findProperty('display_name', jtComponent.display_name);
  403. jtComponent.set('component_value', jtHostName.hostName);
  404. },
  405. loadTtValue: function (ttComponent) {
  406. var ttHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'TaskTracker');
  407. var totalTtHosts = ttHosts.hosts.length;
  408. var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName','TASKTRACKER').groups.length;
  409. var groupLabel;
  410. if (totalGroups == 1) {
  411. groupLabel = 'group';
  412. } else {
  413. groupLabel = 'groups';
  414. }
  415. ttComponent.set('component_value', totalTtHosts + ' hosts ' + '(' + totalGroups + ' ' + groupLabel + ')');
  416. },
  417. /**
  418. * Load all info about Hive service
  419. * @param hiveObj
  420. */
  421. loadHive: function (hiveObj) {
  422. hiveObj.get('service_components').forEach(function (_component) {
  423. switch (_component.get('display_name')) {
  424. case 'Hive Metastore Server':
  425. this.loadHiveMetaStoreValue(_component);
  426. break;
  427. case 'Database':
  428. this.loadHiveDbValue(_component);
  429. break;
  430. default:
  431. }
  432. }, this);
  433. this.get('services').pushObject(hiveObj);
  434. },
  435. loadHiveMetaStoreValue: function (metaStoreComponent) {
  436. var hiveHostName = this.get('content.masterComponentHosts').findProperty('display_name', 'Hive Metastore');
  437. metaStoreComponent.set('component_value', hiveHostName.hostName);
  438. },
  439. loadHiveDbValue: function (dbComponent) {
  440. var hiveDb = App.db.getServiceConfigProperties().findProperty('name', 'hive_database');
  441. if (hiveDb.value === 'New PostgreSQL Database') {
  442. dbComponent.set('component_value', 'PostgreSQL (New Database)');
  443. } else {
  444. var db = App.db.getServiceConfigProperties().findProperty('name', 'hive_existing_database');
  445. dbComponent.set('component_value', db.value + ' (' + hiveDb.value + ')');
  446. }
  447. },
  448. /**
  449. * Load all info about Hbase
  450. * @param hbaseObj
  451. */
  452. loadHbase: function (hbaseObj) {
  453. hbaseObj.service_components.forEach(function (_component) {
  454. switch (_component.display_name) {
  455. case 'Master':
  456. this.loadMasterValue(_component);
  457. break;
  458. case 'Region Servers':
  459. this.loadRegionServerValue(_component);
  460. break;
  461. default:
  462. }
  463. }, this);
  464. this.get('services').pushObject(hbaseObj);
  465. },
  466. loadMasterValue: function (hbaseMaster) {
  467. var hbaseHostName = this.get('content.masterComponentHosts').findProperty('display_name', 'HBase Master');
  468. hbaseMaster.set('component_value', hbaseHostName.hostName);
  469. },
  470. loadRegionServerValue: function (rsComponent) {
  471. var rsHosts = this.get('content.slaveComponentHosts').findProperty('displayName', 'RegionServer');
  472. var totalRsHosts = rsHosts.hosts.length;
  473. var totalGroups = this.get('slaveComponentConfig.components').findProperty('componentName','HBASE_REGIONSERVER').groups.length;
  474. var groupLabel;
  475. if (totalGroups == 1) {
  476. groupLabel = 'group';
  477. } else {
  478. groupLabel = 'groups';
  479. }
  480. rsComponent.set('component_value', totalRsHosts + ' hosts ' + '(' + totalGroups + ' ' + groupLabel + ')');
  481. },
  482. /**
  483. * Load all info about ZooKeeper service
  484. * @param zkObj
  485. */
  486. loadZk: function (zkObj) {
  487. zkObj.get('service_components').forEach(function (_component) {
  488. switch (_component.get('display_name')) {
  489. case 'Servers':
  490. this.loadZkServerValue(_component);
  491. break;
  492. default:
  493. }
  494. }, this);
  495. this.get('services').pushObject(zkObj);
  496. },
  497. loadZkServerValue: function (serverComponent) {
  498. var zkHostNames = this.get('content.masterComponentHosts').filterProperty('display_name', 'ZooKeeper').length;
  499. var hostSuffix;
  500. if (zkHostNames === 1) {
  501. hostSuffix = 'host';
  502. } else {
  503. hostSuffix = 'hosts';
  504. }
  505. serverComponent.set('component_value', zkHostNames + ' ' + hostSuffix);
  506. },
  507. /**
  508. * Load all info about Oozie services
  509. * @param oozieObj
  510. */
  511. loadOozie: function (oozieObj) {
  512. oozieObj.get('service_components').forEach(function (_component) {
  513. switch (_component.get('display_name')) {
  514. case 'Server':
  515. this.loadOozieServerValue(_component);
  516. break;
  517. case 'Database':
  518. // TODO: uncomment when ready to integrate with Oozie Database other than Derby
  519. // this.loadOozieDbValue(_component);
  520. break;
  521. default:
  522. }
  523. }, this);
  524. this.get('services').pushObject(oozieObj);
  525. },
  526. loadOozieServerValue: function (oozieServer) {
  527. var oozieServerName = this.get('content.masterComponentHosts').findProperty('display_name', 'Oozie Server');
  528. oozieServer.set('component_value', oozieServerName.hostName);
  529. },
  530. loadOozieDbValue: function (dbComponent) {
  531. var oozieDb = App.db.getServiceConfigProperties().findProperty('name', 'oozie_database');
  532. if (oozieDb.value === 'New PostgreSQL Database') {
  533. dbComponent.set('component_value', 'PostgreSQL (New Database)');
  534. } else {
  535. var db = App.db.getServiceConfigProperties().findProperty('name', 'oozie_existing_database');
  536. dbComponent.set('component_value', db.value + ' (' + oozieDb.value + ')');
  537. }
  538. },
  539. /**
  540. * Load all info about Nagios service
  541. * @param nagiosObj
  542. */
  543. loadNagios: function (nagiosObj) {
  544. nagiosObj.service_components.forEach(function (_component) {
  545. switch (_component.display_name) {
  546. case 'Server':
  547. this.loadNagiosServerValue(_component);
  548. break;
  549. case 'Administrator':
  550. this.loadNagiosAdminValue(_component);
  551. break;
  552. default:
  553. }
  554. }, this);
  555. this.get('services').pushObject(nagiosObj);
  556. },
  557. loadNagiosServerValue: function (nagiosServer) {
  558. var nagiosServerName = this.get('content.masterComponentHosts').findProperty('display_name', 'Nagios Server');
  559. nagiosServer.set('component_value', nagiosServerName.hostName);
  560. },
  561. loadNagiosAdminValue: function (nagiosAdmin) {
  562. var config = this.get('content.serviceConfigProperties');
  563. var adminLoginName = config.findProperty('name', 'nagios_web_login');
  564. var adminEmail = config.findProperty('name', 'nagios_contact');
  565. nagiosAdmin.set('component_value', adminLoginName.value + ' / (' + adminEmail.value + ')');
  566. },
  567. /**
  568. * Load all info about ganglia
  569. * @param gangliaObj
  570. */
  571. loadGanglia: function (gangliaObj) {
  572. gangliaObj.get('service_components').forEach(function (_component) {
  573. switch (_component.get('display_name')) {
  574. case 'Server':
  575. this.loadGangliaServerValue(_component);
  576. break;
  577. default:
  578. }
  579. }, this);
  580. this.get('services').pushObject(gangliaObj);
  581. },
  582. loadGangliaServerValue: function (gangliaServer) {
  583. var gangliaServerName = this.get('content.masterComponentHosts').findProperty('display_name', 'Ganglia Collector');
  584. gangliaServer.set('component_value', gangliaServerName.hostName);
  585. },
  586. /**
  587. * Onclick handler for <code>next</code> button
  588. */
  589. submit: function () {
  590. if (this.get('isSubmitDisabled')) {
  591. return;
  592. }
  593. this.set('isSubmitDisabled', true);
  594. if (App.testMode || !this.get('content.cluster.requestId')) {
  595. this.createCluster();
  596. this.createSelectedServices();
  597. this.setAmbariUIDb();
  598. this.createConfigurations();
  599. this.applyCreatedConfToServices();
  600. this.createComponents();
  601. this.registerHostsToCluster();
  602. this.createAllHostComponents();
  603. }
  604. App.router.send('next');
  605. },
  606. setAmbariUIDb: function () {
  607. var slaveComponentConfig = this.get("slaveComponentConfig");
  608. this.persistKeyValues(slaveComponentConfig.version, slaveComponentConfig);
  609. },
  610. persistKeyValues: function (key, value) {
  611. var str = "{ '" + key + "' : '" + JSON.stringify(value) + "'}";
  612. var obj = eval("(" + str + ")");
  613. $.ajax({
  614. type: "POST",
  615. url: App.apiPrefix + '/persist',
  616. data: JSON.stringify(obj),
  617. async: false,
  618. dataType: 'text',
  619. timeout: App.timeout,
  620. success: function (data) {
  621. console.debug('success...ajax call returned');
  622. },
  623. error: function (request, ajaxOptions, error) {
  624. console.log('Step8: Error message is: ' + request.responseText);
  625. }
  626. });
  627. },
  628. clusterName: function () {
  629. return this.get('content.cluster.name');
  630. }.property('content.cluster.name'),
  631. /**
  632. * The following create* functions are called upon submitting Step 8.
  633. */
  634. createCluster: function () {
  635. if (this.get('content.isWizard')) {
  636. return false;
  637. }
  638. var url = App.apiPrefix + '/clusters/' + this.get('clusterName');
  639. var stackVersion = (App.db.getSoftRepo().repoType == 'local') ? App.defaultStackVersion + '-local' : App.defaultStackVersion;
  640. $.ajax({
  641. type: 'POST',
  642. url: url,
  643. async: false,
  644. //accepts: 'text',
  645. dataType: 'text',
  646. data: JSON.stringify({ "Clusters": {"version": stackVersion }}),
  647. timeout: App.timeout,
  648. success: function (data) {
  649. var jsonData = jQuery.parseJSON(data);
  650. console.log("TRACE: Step8 -> In success function for createCluster call");
  651. console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
  652. },
  653. error: function (request, ajaxOptions, error) {
  654. console.log('Step8: In Error ');
  655. console.log('Step8: Error message is: ' + request.responseText);
  656. },
  657. statusCode: require('data/statusCodes')
  658. });
  659. console.log("Exiting createCluster");
  660. },
  661. createSelectedServices: function (service, httpMethod) {
  662. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services';
  663. var data = this.createServiceData();
  664. var httpMethod = 'POST';
  665. $.ajax({
  666. type: httpMethod,
  667. url: url,
  668. data: JSON.stringify(data),
  669. async: false,
  670. dataType: 'text',
  671. timeout: App.timeout,
  672. success: function (data) {
  673. var jsonData = jQuery.parseJSON(data);
  674. console.log("TRACE: Step8 -> In success function for the createSelectedServices call");
  675. console.log("TRACE: Step8 -> value of the url is: " + url);
  676. console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
  677. },
  678. error: function (request, ajaxOptions, error) {
  679. console.log('Step8: In Error ');
  680. console.log('Step8: Error message is: ' + request.responseText);
  681. },
  682. statusCode: require('data/statusCodes')
  683. });
  684. },
  685. createServiceData: function () {
  686. var services = this.get('selectedServices').mapProperty('serviceName');
  687. var data = [];
  688. services.forEach(function (_service) {
  689. data.pushObject({"ServiceInfo": { "service_name": _service }});
  690. }, this);
  691. return data;
  692. },
  693. createComponents: function () {
  694. var serviceComponents = require('data/service_components');
  695. var services = this.get('selectedServices').mapProperty('serviceName');
  696. services.forEach(function (_service) {
  697. var components = serviceComponents.filterProperty('service_name', _service);
  698. var componentsData = components.map(function (_component) {
  699. return { "ServiceComponentInfo": { "component_name": _component.component_name } };
  700. });
  701. // Service must be specified in terms of a query for creating multiple components at the same time.
  702. // See AMBARI-1018.
  703. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services?ServiceInfo/service_name=' + _service;
  704. var data = {
  705. "components": componentsData
  706. }
  707. $.ajax({
  708. type: 'POST',
  709. url: url,
  710. async: false,
  711. dataType: 'text',
  712. data: JSON.stringify(data),
  713. timeout: App.timeout,
  714. success: function (data) {
  715. var jsonData = jQuery.parseJSON(data);
  716. console.log("TRACE: Step8 -> In success function for createComponents");
  717. console.log("TRACE: Step8 -> value of the url is: " + url);
  718. console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
  719. },
  720. error: function (request, ajaxOptions, error) {
  721. console.log('Step8: In Error ');
  722. console.log('Step8: Error message is: ' + request.responseText);
  723. },
  724. statusCode: require('data/statusCodes')
  725. });
  726. }, this);
  727. },
  728. registerHostsToCluster: function () {
  729. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts';
  730. var data = this.createRegisterHostData();
  731. if (data.length == 0) {
  732. return;
  733. }
  734. $.ajax({
  735. type: 'POST',
  736. url: url,
  737. data: JSON.stringify(data),
  738. async: false,
  739. dataType: 'text',
  740. timeout: App.timeout,
  741. success: function (data) {
  742. var jsonData = jQuery.parseJSON(data);
  743. console.log("TRACE: Step8 -> In success function for registerHostsToCluster");
  744. console.log("TRACE: Step8 -> value of the url is: " + url);
  745. console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
  746. },
  747. error: function (request, ajaxOptions, error) {
  748. console.log('Step8: In Error ');
  749. console.log('Step8: Error message is: ' + request.responseText);
  750. },
  751. statusCode: require('data/statusCodes')
  752. });
  753. },
  754. createRegisterHostData: function () {
  755. return this.getRegisteredHosts().map(function (host) {
  756. if (!host.isInstalled) {
  757. return {"Hosts": { "host_name": host.hostName}};
  758. }
  759. });
  760. },
  761. // TODO: review the code for add hosts / add services scenarios...
  762. createAllHostComponents: function () {
  763. var masterHosts = this.get('content.masterComponentHosts');
  764. var slaveHosts = this.get('content.slaveComponentHosts');
  765. var clients = this.get('content.clients');
  766. var clientHosts = slaveHosts.filterProperty('componentName', "CLIENT").objectAt(0).hosts;
  767. // note: masterHosts has 'component' vs slaveHosts has 'componentName'
  768. var masterComponents = masterHosts.mapProperty('component').uniq();
  769. masterComponents.forEach(function (component) {
  770. var hostNames = masterHosts.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
  771. this.registerHostsToComponent(hostNames, component);
  772. }, this);
  773. slaveHosts.forEach(function (_slave) {
  774. if (_slave.componentName !== 'CLIENT') {
  775. var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
  776. this.registerHostsToComponent(hostNames, _slave.componentName);
  777. } else {
  778. this.get('content.clients').forEach(function (_client) {
  779. if (!_client.isInstalled) {
  780. var hostNames = clientHosts.mapProperty('hostName').splice(0);
  781. switch (_client.component_name) {
  782. case 'HDFS_CLIENT':
  783. // install HDFS_CLIENT on HBASE_MASTER and HBASE_REGIONSERVER hosts
  784. masterHosts.filterProperty('component', 'HBASE_MASTER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  785. hostNames.pushObject(_masterHost.hostName);
  786. }, this);
  787. masterHosts.filterProperty('component', 'HBASE_REGIONSERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  788. hostNames.pushObject(_masterHost.hostName);
  789. }, this);
  790. break;
  791. case 'MAPREDUCE_CLIENT':
  792. // install MAPREDUCE_CLIENT on HIVE_SERVER and OOZIE_SERVER hosts
  793. masterHosts.filterProperty('component', 'HIVE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  794. hostNames.pushObject(_masterHost.hostName);
  795. }, this);
  796. masterHosts.filterProperty('component', 'OOZIE_SERVER').filterProperty('isInstalled', false).forEach(function (_masterHost) {
  797. hostNames.pushObject(_masterHost.hostName);
  798. }, this);
  799. break;
  800. }
  801. hostNames = hostNames.uniq();
  802. this.registerHostsToComponent(hostNames, _client.component_name);
  803. }
  804. }, this);
  805. }
  806. }, this);
  807. // add Ganglia Monitor (Slave) to all hosts if Ganglia service is selected
  808. if (this.get('selectedServices').someProperty('serviceName', 'GANGLIA')) {
  809. var hosts = this.getRegisteredHosts().filterProperty('isInstalled', false);
  810. this.registerHostsToComponent(hosts.mapProperty('hostName'), 'GANGLIA_MONITOR');
  811. }
  812. },
  813. registerHostsToComponent: function (hostNames, componentName) {
  814. if (hostNames.length == 0) {
  815. return;
  816. }
  817. console.log('registering ' + componentName + ' to ' + JSON.stringify(hostNames));
  818. // currently we are specifying the predicate as a query string.
  819. // this can hit a ~4000-character limit in Jetty server.
  820. // chunk to multiple calls if needed
  821. // var hostsPredicate = hostNames.map(function (hostName) {
  822. // return 'Hosts/host_name=' + hostName;
  823. // }).join('|');
  824. var queryStrArr = []
  825. var queryStr = '';
  826. hostNames.forEach(function (hostName) {
  827. queryStr += 'Hosts/host_name=' + hostName + '|';
  828. if (queryStr.length > 3500) {
  829. queryStrArr.push(queryStr.slice(0, -1));
  830. queryStr = '';
  831. }
  832. });
  833. if (queryStr.length > 0) {
  834. queryStrArr.push(queryStr.slice(0, -1));
  835. }
  836. queryStrArr.forEach(function (queryStr) {
  837. // console.log('creating host components for ' + queryStr);
  838. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/hosts?' + queryStr;
  839. var data = {
  840. "host_components": [
  841. {
  842. "HostRoles": {
  843. "component_name": componentName
  844. }
  845. }
  846. ]
  847. };
  848. $.ajax({
  849. type: 'POST',
  850. url: url,
  851. async: false,
  852. dataType: 'text',
  853. timeout: App.timeout,
  854. data: JSON.stringify(data),
  855. success: function (data) {
  856. var jsonData = jQuery.parseJSON(data);
  857. console.log("TRACE: Step8 -> In success function for the registerHostsToComponent");
  858. console.log("TRACE: Step8 -> value of the url is: " + url);
  859. console.log("TRACE: Step8 -> value of the received data is: " + jsonData);
  860. },
  861. error: function (request, ajaxOptions, error) {
  862. console.log('Step8: In Error ');
  863. console.log('Step8: Error message is: ' + request.responseText);
  864. },
  865. statusCode: require('data/statusCodes')
  866. });
  867. }, this);
  868. },
  869. createConfigurations: function () {
  870. var selectedServices = this.get('selectedServices');
  871. if (!this.get('content.isWizard')) {
  872. this.createConfigSite(this.createGlobalSiteObj());
  873. this.createConfigSite(this.createCoreSiteObj());
  874. this.createConfigSite(this.createHdfsSiteObj('HDFS'));
  875. }
  876. if (selectedServices.someProperty('serviceName', 'MAPREDUCE')) {
  877. this.createConfigSite(this.createMrSiteObj('MAPREDUCE'));
  878. }
  879. if (selectedServices.someProperty('serviceName', 'HBASE')) {
  880. this.createConfigSite(this.createHbaseSiteObj('HBASE'));
  881. }
  882. if (selectedServices.someProperty('serviceName', 'OOZIE')) {
  883. this.createConfigSite(this.createOozieSiteObj('OOZIE'));
  884. }
  885. if (selectedServices.someProperty('serviceName', 'HIVE')) {
  886. // TODO
  887. // this.createConfigSite(this.createHiveSiteObj('HIVE'));
  888. }
  889. },
  890. createConfigSite: function (data) {
  891. console.log("Inside createConfigSite");
  892. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/configurations';
  893. $.ajax({
  894. type: 'POST',
  895. url: url,
  896. data: JSON.stringify(data),
  897. async: false,
  898. dataType: 'text',
  899. timeout: App.timeout,
  900. success: function (data) {
  901. var jsonData = jQuery.parseJSON(data);
  902. console.log("TRACE: STep8 -> In success function for the createConfigSite");
  903. console.log("TRACE: STep8 -> value of the url is: " + url);
  904. console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
  905. },
  906. error: function (request, ajaxOptions, error) {
  907. console.log('Step8: In Error ');
  908. console.log('Step8: Error message is: ' + request.responseText);
  909. console.log("TRACE: STep8 -> value of the url is: " + url);
  910. },
  911. statusCode: require('data/statusCodes')
  912. });
  913. console.log("Exiting createConfigSite");
  914. },
  915. createGlobalSiteObj: function () {
  916. var globalSiteProperties = {};
  917. this.get('globals').forEach(function (_globalSiteObj) {
  918. // do not pass any globals whose name ends with _host or _hosts
  919. if (!/_hosts?$/.test(_globalSiteObj.name)) {
  920. // append "m" to JVM memory options
  921. if (/_heapsize|_newsize|_maxnewsize$/.test(_globalSiteObj.name)) {
  922. _globalSiteObj.value += "m";
  923. }
  924. globalSiteProperties[_globalSiteObj.name] = _globalSiteObj.value;
  925. console.log("STEP8: name of the global property is: " + _globalSiteObj.name);
  926. console.log("STEP8: value of the global property is: " + _globalSiteObj.value);
  927. }
  928. }, this);
  929. return {"type": "global", "tag": "version1", "properties": globalSiteProperties};
  930. },
  931. createCoreSiteObj: function () {
  932. var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml');
  933. var coreSiteProperties = {};
  934. // hadoop.proxyuser.oozie.hosts needs to be skipped if oozie is not selected
  935. var isOozieSelected = this.get('selectedServices').someProperty('serviceName', 'OOZIE');
  936. coreSiteObj.forEach(function (_coreSiteObj) {
  937. if (isOozieSelected || _coreSiteObj.name != 'hadoop.proxyuser.oozie.hosts') {
  938. coreSiteProperties[_coreSiteObj.name] = _coreSiteObj.value;
  939. }
  940. console.log("STEP*: name of the property is: " + _coreSiteObj.name);
  941. console.log("STEP8: value of the property is: " + _coreSiteObj.value);
  942. }, this);
  943. return {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
  944. },
  945. createHdfsSiteObj: function (serviceName) {
  946. var hdfsSiteObj = this.get('configs').filterProperty('filename', 'hdfs-site.xml');
  947. var hdfsProperties = {};
  948. hdfsSiteObj.forEach(function (_configProperty) {
  949. hdfsProperties[_configProperty.name] = _configProperty.value;
  950. console.log("STEP*: name of the property is: " + _configProperty.name);
  951. console.log("STEP8: value of the property is: " + _configProperty.value);
  952. }, this);
  953. return {"type": "hdfs-site", "tag": "version1", "properties": hdfsProperties };
  954. },
  955. createMrSiteObj: function (serviceName) {
  956. var configs = this.get('configs').filterProperty('filename', 'mapred-site.xml');
  957. var mrProperties = {};
  958. configs.forEach(function (_configProperty) {
  959. mrProperties[_configProperty.name] = _configProperty.value;
  960. console.log("STEP*: name of the property is: " + _configProperty.name);
  961. console.log("STEP8: value of the property is: " + _configProperty.value);
  962. }, this);
  963. return {type: 'mapred-site', tag: 'version1', properties: mrProperties};
  964. },
  965. createHbaseSiteObj: function (serviceName) {
  966. var configs = this.get('configs').filterProperty('filename', 'hbase-site.xml');
  967. var hbaseProperties = {};
  968. configs.forEach(function (_configProperty) {
  969. hbaseProperties[_configProperty.name] = _configProperty.value;
  970. }, this);
  971. var masterHosts = App.db.getMasterComponentHosts();
  972. // TODO: should filter on "component" but that gives unexpected results
  973. var zkServers = masterHosts.filterProperty('display_name', 'ZooKeeper').mapProperty('hostName');
  974. hbaseProperties['hbase.zookeeper.quorum'] = zkServers.join(',');
  975. return {type: 'hbase-site', tag: 'version1', properties: hbaseProperties};
  976. },
  977. createOozieSiteObj: function (serviceName) {
  978. var configs = this.get('configs').filterProperty('filename', 'oozie-site.xml');
  979. var oozieProperties = {};
  980. configs.forEach(function (_configProperty) {
  981. oozieProperties[_configProperty.name] = _configProperty.value;
  982. }, this);
  983. var baseUrl = oozieProperties['oozie.base.url'];
  984. oozieProperties = {
  985. "oozie.service.JPAService.jdbc.password": " ", "oozie.db.schema.name": "oozie", "oozie.service.JPAService.jdbc.url": "jdbc:derby:/var/data/oozie/oozie-db;create=true", "oozie.service.JPAService.jdbc.driver": "org.apache.derby.jdbc.EmbeddedDriver", "oozie.service.WorkflowAppService.system.libpath": "/user/oozie/share/lib", "oozie.service.JPAService.jdbc.username": "sa", "oozie.service.SchemaService.wf.ext.schemas": "shell-action-0.1.xsd,email-action-0.1.xsd,hive-action-0.2.xsd,sqoop-action-0.2.xsd,ssh-action-0.1.xsd,distcp-action-0.1.xsd", "oozie.service.JPAService.create.db.schema": "false", "use.system.libpath.for.mapreduce.and.pig.jobs": "false", "oozie.service.ActionService.executor.ext.classes": "org.apache.oozie.action.email.EmailActionExecutor,org.apache.oozie.action.hadoop.HiveActionExecutor,org.apache.oozie.action.hadoop.ShellActionExecutor,org.apache.oozie.action.hadoop.SqoopActionExecutor,org.apache.oozie.action.hadoop.DistcpActionExecutor", "oozie.service.HadoopAccessorService.hadoop.configurations": "*=/etc/hadoop/conf"
  986. };
  987. oozieProperties['oozie.base.url'] = baseUrl;
  988. return {type: 'oozie-site', tag: 'version1', properties: oozieProperties};
  989. },
  990. createHiveSiteObj: function (serviceName) {
  991. var configs = this.get('configs').filterProperty('filename', 'hive-site.xml');
  992. var hiveProperties = {};
  993. configs.forEach(function (_configProperty) {
  994. hiveProperties[_configProperty.name] = _configProperty.value;
  995. }, this);
  996. return {type: 'hbase-site', tag: 'version1', properties: hiveProperties};
  997. },
  998. applyCreatedConfToServices: function () {
  999. var services = this.get('selectedServices').mapProperty('serviceName');
  1000. services.forEach(function (_service) {
  1001. var data = this.getConfigForService(_service);
  1002. this.applyCreatedConfToService(_service, 'PUT', data);
  1003. }, this);
  1004. },
  1005. applyCreatedConfToService: function (service, httpMethod, data) {
  1006. console.log("Inside applyCreatedConfToService");
  1007. var url = App.apiPrefix + '/clusters/' + this.get('clusterName') + '/services/' + service;
  1008. $.ajax({
  1009. type: httpMethod,
  1010. url: url,
  1011. async: false,
  1012. dataType: 'text',
  1013. data: JSON.stringify(data),
  1014. timeout: App.timeout,
  1015. success: function (data) {
  1016. var jsonData = jQuery.parseJSON(data);
  1017. console.log("TRACE: STep8 -> In success function for the applyCreatedConfToService call");
  1018. console.log("TRACE: STep8 -> value of the url is: " + url);
  1019. console.log("TRACE: STep8 -> value of the received data is: " + jsonData);
  1020. },
  1021. error: function (request, ajaxOptions, error) {
  1022. console.log('Step8: In Error ');
  1023. console.log('Step8: Error message is: ' + request.responseText);
  1024. },
  1025. statusCode: require('data/statusCodes')
  1026. });
  1027. console.log("Exiting applyCreatedConfToService");
  1028. },
  1029. getConfigForService: function (serviceName) {
  1030. switch (serviceName) {
  1031. case 'HDFS':
  1032. return {config: {'global': 'version1', 'core-site': 'version1', 'hdfs-site': 'version1'}};
  1033. case 'MAPREDUCE':
  1034. return {config: {'global': 'version1', 'core-site': 'version1', 'mapred-site': 'version1'}};
  1035. case 'HBASE':
  1036. return {config: {'global': 'version1', 'core-site': 'version1', 'hbase-site': 'version1'}};
  1037. case 'OOZIE':
  1038. return {config: {'global': 'version1', 'core-site': 'version1', 'oozie-site': 'version1'}};
  1039. default:
  1040. return {config: {'global': 'version1'}};
  1041. }
  1042. }
  1043. })