step9_controller.js 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  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.WizardStep9Controller = Em.Controller.extend({
  20. name: 'wizardStep9Controller',
  21. /**
  22. * Array of host Objects that are successfully registered on "Confirm Host Options" page
  23. * <code>
  24. * {
  25. * name: {String} host name.
  26. * status: {String} Current status of the host. This field is used in the step 9 view to set the css class of the
  27. * host progress bar and set the appropriate message. Possible values: info, warning, failed, heartbeat_lost and success
  28. * logTasks: {Array} Tasks that are scheduled on the host for the current request.
  29. * message: {String} Message to be shown in front of the host name.
  30. * progress: {Int} Progress of the tasks on the host. Amount of tasks completed for all the tasks scheduled on the host.
  31. * isNoTasksForInstall: {Boolean} Gets set when no task is scheduled for the host on install phase.
  32. * }
  33. * </code>
  34. * @type {Array.<{name: string, status: string, logTasks: object[], message: string, progress: number, isNoTasksForInstall: bool}>}
  35. */
  36. hosts: [],
  37. /**
  38. * Overall progress of <Install,Start and Test> page shown as progress bar on the top of the page
  39. * @type {string}
  40. */
  41. progress: '0',
  42. /*
  43. * Json file for the mock data to be used in mock mode
  44. * @type {string}
  45. */
  46. mockDataPrefix: '/data/wizard/deploy/5_hosts',
  47. /*
  48. * Current Request data polled from the API: api/v1/clusters/{clusterName}/requests/{RequestId}?fields=tasks/Tasks/command,
  49. * tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,
  50. * tasks/Tasks/status&minimal_response=true
  51. * @type {Object[]}
  52. */
  53. polledData: [],
  54. /*
  55. * This flag is only used in UI mock mode as a counter for number of polls.
  56. * @type {number}
  57. */
  58. numPolls: 1,
  59. /**
  60. * Interval in milliseconds between API calls While polling the request status for Install and, Start and Test tasks
  61. * @type {number}
  62. */
  63. POLL_INTERVAL: 4000,
  64. /**
  65. * Array of objects
  66. * <code>
  67. * {
  68. * hostName: {String} Name of host that has stopped heartbeating to ambari-server
  69. * componentNames: {Sting} Name of all components that are on the host
  70. * }
  71. * </code>
  72. * @type {Object[]}
  73. */
  74. hostsWithHeartbeatLost: [],
  75. /**
  76. * Flag is set in the start all services error callback function
  77. * @type {bool}
  78. */
  79. startCallFailed: false,
  80. /*
  81. * Status of the page. Possible values: <info, warning, failed and success>.
  82. * This property is used in the step-9 view for displaying the appropriate color of the overall progress bar and
  83. * the appropriate result message at the bottom of the page
  84. * @type {string}
  85. */
  86. status: 'info',
  87. /**
  88. * This computed property is used to determine if the Next button and back button on the page should be disabled. The property is
  89. * used in the template to grey out Next and Back buttons. Although clicking on the greyed out button do trigger the event and
  90. * calls submit and back function of the controller.
  91. * @type {bool}
  92. */
  93. isSubmitDisabled: function () {
  94. var validStates = ['STARTED', 'START FAILED'];
  95. var controllerName = this.get('content.controllerName');
  96. if (controllerName == 'addHostController' || controllerName == 'addServiceController') {
  97. validStates.push('INSTALL FAILED');
  98. }
  99. return !validStates.contains(this.get('content.cluster.status'));
  100. }.property('content.cluster.status'),
  101. /**
  102. * Observer function: Enables previous steps link if install task failed in installer wizard.
  103. * @method togglePreviousSteps
  104. */
  105. togglePreviousSteps: function () {
  106. if (App.testMode) {
  107. return;
  108. }
  109. var installerController = App.router.get('installerController');
  110. if ('INSTALL FAILED' === this.get('content.cluster.status') && this.get('content.controllerName') == 'installerController') {
  111. installerController.setStepsEnable();
  112. } else {
  113. installerController.setLowerStepsDisable(9);
  114. }
  115. }.observes('content.cluster.status', 'content.controllerName'),
  116. /*
  117. * Computed property to determine if the Retry button should be made visible on the page.
  118. * @type {bool}
  119. */
  120. showRetry: function () {
  121. return this.get('content.cluster.status') == 'INSTALL FAILED';
  122. }.property('content.cluster.status'),
  123. /**
  124. * Observer function: Calls {hostStatusUpdates} function once with change in a host status from any registered hosts.
  125. * @method hostStatusObserver
  126. */
  127. hostStatusObserver: function () {
  128. Em.run.once(this, 'updateStatus');
  129. }.observes('hosts.@each.status'),
  130. /**
  131. * A flag that gets set with installation failure.
  132. * @type {bool}
  133. */
  134. installFailed: false,
  135. /**
  136. * Incremental flag that triggers an event in step 9 view to change the tasks related data and icons of hosts.
  137. * @type {number}
  138. */
  139. logTasksChangesCounter: 0,
  140. /**
  141. * <code>taskId</code> of current open task
  142. * @type {number}
  143. */
  144. currentOpenTaskId: 0,
  145. /**
  146. * <code>requestId</code> of current open task
  147. * @type {number}
  148. */
  149. currentOpenTaskRequestId: 0,
  150. /**
  151. * True if stage transition is completed.
  152. * On true, polling will be stopped.
  153. * @type {bool}s
  154. */
  155. parseHostInfo: false,
  156. isPolling: true,
  157. changeParseHostInfo: function (value) {
  158. this.set('parseHostInfo', value);
  159. this.parseHostInfoPolling();
  160. },
  161. parseHostInfoPolling: function () {
  162. var self = this;
  163. var result = this.get('parseHostInfo');
  164. if (!this.get('isPolling')) {
  165. if (this.get('content.cluster.status') === 'INSTALL FAILED') {
  166. this.isAllComponentsInstalled();
  167. }
  168. return;
  169. }
  170. if (result !== true) {
  171. window.setTimeout(function () {
  172. if (self.get('currentOpenTaskId')) {
  173. self.loadCurrentTaskLog();
  174. }
  175. self.doPolling();
  176. }, this.get('POLL_INTERVAL'));
  177. }
  178. },
  179. /**
  180. * Observer function: Updates {status} field of the controller.
  181. * @method updateStatus
  182. */
  183. updateStatus: function () {
  184. var status = 'info';
  185. if (this.get('hosts').someProperty('status', 'failed')
  186. || this.get('hosts').someProperty('status', 'heartbeat_lost')
  187. || this.get('startCallFailed')) {
  188. status = 'failed';
  189. } else if (this.get('hosts').someProperty('status', 'warning')) {
  190. if (this.isStepFailed()) {
  191. status = 'failed';
  192. } else {
  193. status = 'warning';
  194. }
  195. } else if (this.get('progress') == '100' && this.get('content.cluster.status') !== 'INSTALL FAILED') {
  196. status = 'success';
  197. }
  198. this.set('status', status);
  199. }.observes('progress'),
  200. /**
  201. * This function is called when a click event happens on Next button of "Install, Start and Test" page
  202. * @method submit
  203. */
  204. submit: function () {
  205. App.router.send('next');
  206. },
  207. /**
  208. * This function is called when a click event happens on back button of "Install, Start and Test" page
  209. * @method back
  210. */
  211. back: function () {
  212. if (!this.get('isSubmitDisabled')) {
  213. App.router.send('back');
  214. }
  215. },
  216. /**
  217. * navigateStep is called by App.WizardStep9View's didInsertElement and "retry" from router.
  218. * content.cluster.status can be:
  219. * PENDING: set upon successful transition from step 1 to step 2
  220. * INSTALLED: set upon successful completion of install phase as well as successful invocation of start services API
  221. * STARTED: set up on successful completion of start phase
  222. * INSTALL FAILED: set up upon encountering a failure in install phase
  223. * START FAILED: set upon unsuccessful invocation of start services API and also upon encountering a failure
  224. * during start phase
  225. * content.cluster.isCompleted
  226. * set to false upon successful transition from step 1 to step 2
  227. * set to true upon successful start of services in this step
  228. * note: looks like this is the same thing as checking content.cluster.status == 'STARTED'
  229. * @method navigateStep
  230. */
  231. navigateStep: function () {
  232. if (App.testMode) {
  233. // this is for repeatedly testing out installs in test mode
  234. this.set('content.cluster.status', 'PENDING');
  235. this.set('content.cluster.isCompleted', false);
  236. this.set('content.cluster.requestId', 1);
  237. }
  238. var needPolling = false;
  239. var clusterStatus = this.get('content.cluster.status');
  240. console.log('navigateStep: clusterStatus = ' + clusterStatus);
  241. if (this.get('content.cluster.isCompleted') === false) {
  242. if (clusterStatus !== 'INSTALL FAILED' && clusterStatus !== 'START FAILED') {
  243. needPolling = true;
  244. }
  245. } else {
  246. // handle STARTED
  247. // the cluster has successfully installed and started
  248. this.set('progress', '100');
  249. }
  250. this.loadStep();
  251. this.loadLogData(needPolling);
  252. },
  253. /**
  254. * This is called on initial page load, refreshes and retry event.
  255. * clears all in memory stale data for retry event.
  256. * @method clearStep
  257. */
  258. clearStep: function () {
  259. this.get('hosts').clear();
  260. this.set('hostsWithHeartbeatLost', []);
  261. this.set('startCallFailed', false);
  262. this.set('status', 'info');
  263. this.set('progress', '0');
  264. this.set('numPolls', 1);
  265. },
  266. /**
  267. * This is called on initial page load, refreshes and retry event.
  268. * @method loadStep
  269. */
  270. loadStep: function () {
  271. console.log("TRACE: Loading step9: Install, Start and Test");
  272. this.clearStep();
  273. this.loadHosts();
  274. },
  275. /**
  276. * Reset status and message of all hosts when retry install
  277. * @method resetHostsForRetry
  278. */
  279. resetHostsForRetry: function () {
  280. var hosts = this.get('content.hosts');
  281. for (var name in hosts) {
  282. if (hosts.hasOwnProperty(name)) {
  283. hosts[name].status = "pending";
  284. hosts[name].message = 'Waiting';
  285. hosts[name].isNoTasksForInstall = false;
  286. }
  287. }
  288. this.set('content.hosts', hosts);
  289. },
  290. /**
  291. * Sets the <code>hosts</code> array for the controller
  292. * @method loadHosts
  293. */
  294. loadHosts: function () {
  295. var hosts = this.get('content.hosts');
  296. //flag identify whether get all hosts or only NewHosts(newly added) hosts
  297. var getOnlyNewHosts = (this.get('content.controllerName') !== 'addServiceController');
  298. for (var index in hosts) {
  299. if (hosts[index].bootStatus === 'REGISTERED' && (!getOnlyNewHosts || !hosts[index].isInstalled)) {
  300. var hostInfo = App.HostInfo.create({
  301. name: hosts[index].name,
  302. status: (hosts[index].status) ? hosts[index].status : 'info',
  303. logTasks: [],
  304. message: (hosts[index].message) ? hosts[index].message : 'Waiting',
  305. progress: 0,
  306. isNoTasksForInstall: false
  307. });
  308. this.get('hosts').pushObject(hostInfo);
  309. }
  310. }
  311. },
  312. /**
  313. * Set new polled data
  314. * @param polledData sets the <code>polledData</code> object of the controller
  315. * @method replacePolledData
  316. */
  317. replacePolledData: function (polledData) {
  318. this.get('polledData').clear();
  319. this.set('polledData', polledData);
  320. },
  321. /**
  322. * Get the appropriate message for the host as per the running task
  323. * @param {object} task
  324. * @returns {String}
  325. * @method displayMessage
  326. */
  327. displayMessage: function (task) {
  328. var role = App.format.role(task.role);
  329. /* istanbul ignore next */
  330. switch (task.command) {
  331. case 'INSTALL':
  332. switch (task.status) {
  333. case 'PENDING':
  334. return Em.I18n.t('installer.step9.serviceStatus.install.pending') + role;
  335. case 'QUEUED' :
  336. return Em.I18n.t('installer.step9.serviceStatus.install.queued') + role;
  337. case 'IN_PROGRESS':
  338. return Em.I18n.t('installer.step9.serviceStatus.install.inProgress') + role;
  339. case 'COMPLETED' :
  340. return Em.I18n.t('installer.step9.serviceStatus.install.completed') + role;
  341. case 'FAILED':
  342. return Em.I18n.t('installer.step9.serviceStatus.install.failed') + role;
  343. }
  344. break;
  345. case 'UNINSTALL':
  346. switch (task.status) {
  347. case 'PENDING':
  348. return Em.I18n.t('installer.step9.serviceStatus.uninstall.pending') + role;
  349. case 'QUEUED' :
  350. return Em.I18n.t('installer.step9.serviceStatus.uninstall.queued') + role;
  351. case 'IN_PROGRESS':
  352. return Em.I18n.t('installer.step9.serviceStatus.uninstall.inProgress') + role;
  353. case 'COMPLETED' :
  354. return Em.I18n.t('installer.step9.serviceStatus.uninstall.completed') + role;
  355. case 'FAILED':
  356. return Em.I18n.t('installer.step9.serviceStatus.uninstall.failed') + role;
  357. }
  358. break;
  359. case 'START' :
  360. switch (task.status) {
  361. case 'PENDING':
  362. return Em.I18n.t('installer.step9.serviceStatus.start.pending') + role;
  363. case 'QUEUED' :
  364. return Em.I18n.t('installer.step9.serviceStatus.start.queued') + role;
  365. case 'IN_PROGRESS':
  366. return Em.I18n.t('installer.step9.serviceStatus.start.inProgress') + role;
  367. case 'COMPLETED' :
  368. return role + Em.I18n.t('installer.step9.serviceStatus.start.completed');
  369. case 'FAILED':
  370. return role + Em.I18n.t('installer.step9.serviceStatus.start.failed');
  371. }
  372. break;
  373. case 'STOP' :
  374. switch (task.status) {
  375. case 'PENDING':
  376. return Em.I18n.t('installer.step9.serviceStatus.stop.pending') + role;
  377. case 'QUEUED' :
  378. return Em.I18n.t('installer.step9.serviceStatus.stop.queued') + role;
  379. case 'IN_PROGRESS':
  380. return Em.I18n.t('installer.step9.serviceStatus.stop.inProgress') + role;
  381. case 'COMPLETED' :
  382. return role + Em.I18n.t('installer.step9.serviceStatus.stop.completed');
  383. case 'FAILED':
  384. return role + Em.I18n.t('installer.step9.serviceStatus.stop.failed');
  385. }
  386. break;
  387. case 'EXECUTE' :
  388. case 'SERVICE_CHECK' :
  389. switch (task.status) {
  390. case 'PENDING':
  391. return Em.I18n.t('installer.step9.serviceStatus.execute.pending') + role;
  392. case 'QUEUED' :
  393. return Em.I18n.t('installer.step9.serviceStatus.execute.queued') + role;
  394. case 'IN_PROGRESS':
  395. return Em.I18n.t('installer.step9.serviceStatus.execute.inProgress') + role;
  396. case 'COMPLETED' :
  397. return role + Em.I18n.t('installer.step9.serviceStatus.execute.completed');
  398. case 'FAILED':
  399. return role + Em.I18n.t('installer.step9.serviceStatus.execute.failed');
  400. }
  401. break;
  402. case 'ABORT' :
  403. switch (task.status) {
  404. case 'PENDING':
  405. return Em.I18n.t('installer.step9.serviceStatus.abort.pending') + role;
  406. case 'QUEUED' :
  407. return Em.I18n.t('installer.step9.serviceStatus.abort.queued') + role;
  408. case 'IN_PROGRESS':
  409. return Em.I18n.t('installer.step9.serviceStatus.abort.inProgress') + role;
  410. case 'COMPLETED' :
  411. return role + Em.I18n.t('installer.step9.serviceStatus.abort.completed');
  412. case 'FAILED':
  413. return role + Em.I18n.t('installer.step9.serviceStatus.abort.failed');
  414. }
  415. }
  416. return '';
  417. },
  418. /**
  419. * Run start/check services after installation phase.
  420. * Does Ajax call to start all services
  421. * @return {$.ajax|null}
  422. * @method launchStartServices
  423. */
  424. launchStartServices: function (callback) {
  425. var data = {};
  426. var name = '';
  427. var servicesList = [];
  428. callback = callback || Em.K;
  429. if (this.get('content.controllerName') === 'addHostController') {
  430. name = 'wizard.step9.add_host.launch_start_services';
  431. var hostnames = [];
  432. for (var hostname in this.get('wizardController').getDBProperty('hosts')) {
  433. if(this.get('hosts').findProperty('name', hostname)){
  434. hostnames.push(hostname);
  435. }
  436. }
  437. data = {
  438. "RequestInfo": {
  439. "context": Em.I18n.t("requestInfo.startHostComponents"),
  440. "query": "HostRoles/component_name.in(" + App.get('components.slaves').join(',') + ")&HostRoles/state=INSTALLED&HostRoles/host_name.in(" + hostnames.join(',') + ")"
  441. },
  442. "Body": {
  443. "HostRoles": { "state": "STARTED" }
  444. }
  445. };
  446. } else if (this.get('content.controllerName') === 'addServiceController') {
  447. servicesList = this.get('content.services').filterProperty('isSelected', true).filterProperty('isDisabled', false).mapProperty('serviceName');
  448. name = 'wizard.step9.add_service.launch_start_services';
  449. data = {
  450. "RequestInfo": {
  451. "context": Em.I18n.t("requestInfo.startAddedServices")
  452. },
  453. "Body": {
  454. "ServiceInfo": { "state": "STARTED" }
  455. }
  456. };
  457. } else {
  458. name = 'wizard.step9.installer.launch_start_services';
  459. data = {
  460. "RequestInfo": {
  461. "context": Em.I18n.t("requestInfo.startServices")
  462. },
  463. "Body": {
  464. "ServiceInfo": { "state": "STARTED" }
  465. }
  466. };
  467. }
  468. data = JSON.stringify(data);
  469. if (App.testMode) {
  470. this.set('numPolls', 6);
  471. }
  472. return App.ajax.send({
  473. name: name,
  474. sender: this,
  475. data: {
  476. data: data,
  477. cluster: this.get('content.cluster.name'),
  478. servicesList: servicesList // used only for Add Service wizard
  479. },
  480. success: 'launchStartServicesSuccessCallback',
  481. error: 'launchStartServicesErrorCallback'
  482. }).then(callback, callback);
  483. },
  484. /**
  485. * Success callback function for start services task.
  486. * @param {object} jsonData Contains Request id to poll.
  487. * @method launchStartServicesSuccessCallback
  488. */
  489. launchStartServicesSuccessCallback: function (jsonData) {
  490. var clusterStatus = {};
  491. if (jsonData) {
  492. console.log("TRACE: Step9 -> In success function for the startService call");
  493. console.log("TRACE: Step9 -> value of the received data is: " + jsonData);
  494. var requestId = jsonData.Requests.id;
  495. console.log('requestId is: ' + requestId);
  496. clusterStatus = {
  497. status: 'INSTALLED',
  498. requestId: requestId,
  499. isStartError: false,
  500. isCompleted: false
  501. };
  502. this.hostHasClientsOnly(false);
  503. this.saveClusterStatus(clusterStatus);
  504. }
  505. else {
  506. console.log('ERROR: Error occurred in parsing JSON data');
  507. this.hostHasClientsOnly(true);
  508. clusterStatus = {
  509. status: 'STARTED',
  510. isStartError: false,
  511. isCompleted: true
  512. };
  513. this.saveClusterStatus(clusterStatus);
  514. this.set('status', 'success');
  515. this.set('progress', '100');
  516. }
  517. // We need to do recovery if there is a browser crash
  518. App.clusterStatus.setClusterStatus({
  519. clusterState: 'SERVICE_STARTING_3',
  520. wizardControllerName: this.get('content.controllerName'),
  521. localdb: App.db.data
  522. });
  523. if (jsonData) {
  524. this.startPolling();
  525. }
  526. },
  527. /**
  528. * This function will be called for Add host wizard only.
  529. * @param {bool} jsonError Boolean is true when API to start services returns 200 ok and no json data
  530. * @method hostHasClientsOnly
  531. */
  532. hostHasClientsOnly: function (jsonError) {
  533. this.get('hosts').forEach(function (host) {
  534. var OnlyClients = true;
  535. var tasks = host.get('logTasks');
  536. tasks.forEach(function (task) {
  537. var component = App.StackServiceComponent.find().findProperty('componentName', task.Tasks.role);
  538. if (!(component && component.get('isClient'))) {
  539. OnlyClients = false;
  540. }
  541. });
  542. if (OnlyClients || jsonError) {
  543. host.set('status', 'success');
  544. host.set('progress', '100');
  545. }
  546. });
  547. },
  548. /**
  549. * Error callback function for start services task.
  550. * @param {object} jqXHR
  551. * @param {object} ajaxOptions
  552. * @param {string} error
  553. * @param {object} opt
  554. * @method launchStartServicesErrorCallback
  555. */
  556. launchStartServicesErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
  557. console.log("ERROR");
  558. this.set('startCallFailed', true);
  559. var clusterStatus = {
  560. status: 'INSTALL FAILED',
  561. isStartError: false,
  562. isCompleted: false
  563. };
  564. this.saveClusterStatus(clusterStatus);
  565. this.get('hosts').forEach(function (host) {
  566. host.set('progress', '100');
  567. });
  568. this.set('progress', '100');
  569. App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.method, jqXHR.status);
  570. },
  571. /**
  572. * Marks a host's status as "success" if all tasks are in COMPLETED state
  573. * @method onSuccessPerHost
  574. */
  575. onSuccessPerHost: function (actions, contentHost) {
  576. if (actions.everyProperty('Tasks.status', 'COMPLETED') && this.get('content.cluster.status') === 'INSTALLED') {
  577. contentHost.set('status', 'success');
  578. }
  579. },
  580. /**
  581. * marks a host's status as "warning" if at least one of the tasks is FAILED, ABORTED, or TIMEDOUT and marks host's status as "failed" if at least one master component install task is FAILED.
  582. * note that if the master failed to install because of ABORTED or TIMEDOUT, we don't mark it as failed, because this would mark all hosts as "failed" and makes it difficult for the user
  583. * to find which host FAILED occurred on, if any
  584. * @param actions {Array} of tasks retrieved from polled data
  585. * @param contentHost {Object} A host object
  586. * @method onErrorPerHost
  587. */
  588. onErrorPerHost: function (actions, contentHost) {
  589. if (!actions) return;
  590. if (actions.someProperty('Tasks.status', 'FAILED') || actions.someProperty('Tasks.status', 'ABORTED') || actions.someProperty('Tasks.status', 'TIMEDOUT')) {
  591. contentHost.set('status', 'warning');
  592. }
  593. if ((this.get('content.cluster.status') === 'PENDING' && actions.someProperty('Tasks.status', 'FAILED')) || (this.isMasterFailed(actions))) {
  594. contentHost.get('status') !== 'heartbeat_lost' ? contentHost.set('status', 'failed') : '';
  595. }
  596. },
  597. /**
  598. * Check if some master component is failed
  599. * @param {object} polledData data polled from API.
  600. * @returns {bool} true if there is at least one FAILED task of master component install
  601. * @method isMasterFailed
  602. */
  603. isMasterFailed: function (polledData) {
  604. var result = false;
  605. polledData.filterProperty('Tasks.command', 'INSTALL').filterProperty('Tasks.status', 'FAILED').mapProperty('Tasks.role').forEach(
  606. function (role) {
  607. if (!App.get('components.slaves').contains(role)) {
  608. result = true;
  609. }
  610. }
  611. );
  612. return result;
  613. },
  614. /**
  615. * Mark a host status as in_progress if the any task on the host if either in IN_PROGRESS, QUEUED or PENDONG state.
  616. * @param actions {Array} of tasks retrieved from polled data
  617. * @param contentHost {Object} A host object
  618. * @method onInProgressPerHost
  619. */
  620. onInProgressPerHost: function (actions, contentHost) {
  621. var runningAction = actions.findProperty('Tasks.status', 'IN_PROGRESS');
  622. if (runningAction === undefined || runningAction === null) {
  623. runningAction = actions.findProperty('Tasks.status', 'QUEUED');
  624. }
  625. if (runningAction === undefined || runningAction === null) {
  626. runningAction = actions.findProperty('Tasks.status', 'PENDING');
  627. }
  628. if (runningAction !== null && runningAction !== undefined) {
  629. contentHost.set('status', 'in_progress');
  630. contentHost.set('message', this.displayMessage(runningAction.Tasks));
  631. }
  632. },
  633. /**
  634. * Calculate progress of tasks per host
  635. * @param {object} actions
  636. * @param {object} contentHost
  637. * @return {Number}
  638. * @method progressPerHost
  639. */
  640. progressPerHost: function (actions, contentHost) {
  641. var progress = 0;
  642. var actionsPerHost = actions.length;
  643. var completedActions = 0;
  644. var queuedActions = 0;
  645. var inProgressActions = 0;
  646. actions.forEach(function (action) {
  647. completedActions += +(['COMPLETED', 'FAILED', 'ABORTED', 'TIMEDOUT'].contains(action.Tasks.status));
  648. queuedActions += +(action.Tasks.status === 'QUEUED');
  649. inProgressActions += +(action.Tasks.status === 'IN_PROGRESS');
  650. }, this);
  651. /** for the install phase (PENDING), % completed per host goes up to 33%; floor(100 / 3)
  652. * for the start phase (INSTALLED), % completed starts from 34%
  653. * when task in queued state means it's completed on 9%
  654. * in progress - 35%
  655. * completed - 100%
  656. */
  657. switch (this.get('content.cluster.status')) {
  658. case 'PENDING':
  659. progress = actionsPerHost ? (Math.ceil(((queuedActions * 0.09) + (inProgressActions * 0.35) + completedActions ) / actionsPerHost * 33)) : 33;
  660. break;
  661. case 'INSTALLED':
  662. progress = actionsPerHost ? (34 + Math.ceil(((queuedActions * 0.09) + (inProgressActions * 0.35) + completedActions ) / actionsPerHost * 66)) : 100;
  663. break;
  664. default:
  665. progress = 100;
  666. break;
  667. }
  668. contentHost.set('progress', progress.toString());
  669. return progress;
  670. },
  671. /**
  672. * Check if step completed successfully
  673. * @param {object} polledData data retrieved from API
  674. * @returns {bool}
  675. * @method isSuccess
  676. */
  677. isSuccess: function (polledData) {
  678. return polledData.everyProperty('Tasks.status', 'COMPLETED');
  679. },
  680. /**
  681. * Check if step is failed
  682. * Return true if:
  683. * 1. any of the master/client components failed to install
  684. * OR
  685. * 2. at least 50% of the slave host components for the particular service component fails to install
  686. * @method isStepFailed
  687. */
  688. isStepFailed: function () {
  689. var failed = false;
  690. var polledData = this.get('polledData');
  691. polledData.filterProperty('Tasks.command', 'INSTALL').mapProperty('Tasks.role').uniq().forEach(function (role) {
  692. if (failed) {
  693. return;
  694. }
  695. var actionsPerRole = polledData.filterProperty('Tasks.role', role);
  696. if (App.get('components.slaves').contains(role)) {
  697. // check slave components for success factor.
  698. // partial failure for slave components are allowed.
  699. var actionsFailed = actionsPerRole.filterProperty('Tasks.status', 'FAILED');
  700. var actionsAborted = actionsPerRole.filterProperty('Tasks.status', 'ABORTED');
  701. var actionsTimedOut = actionsPerRole.filterProperty('Tasks.status', 'TIMEDOUT');
  702. if ((((actionsFailed.length + actionsAborted.length + actionsTimedOut.length) / actionsPerRole.length) * 100) > 50) {
  703. failed = true;
  704. }
  705. } else if (actionsPerRole.someProperty('Tasks.status', 'FAILED') || actionsPerRole.someProperty('Tasks.status', 'ABORTED') ||
  706. actionsPerRole.someProperty('Tasks.status', 'TIMEDOUT')) {
  707. // check non-salve components (i.e., masters and clients). all of these must be successfully installed.
  708. failed = true;
  709. }
  710. }, this);
  711. return failed;
  712. },
  713. /**
  714. * polling from ui stops only when no action has 'PENDING', 'QUEUED' or 'IN_PROGRESS' status
  715. * Makes a state transition
  716. * PENDING -> INSTALLED
  717. * PENDING -> INSTALL FAILED
  718. * INSTALLED -> STARTED
  719. * INSTALLED -> START_FAILED
  720. * @param polledData json data retrieved from API
  721. * @method setFinishState
  722. */
  723. setFinishState: function (polledData) {
  724. if (this.get('content.cluster.status') === 'INSTALLED') {
  725. this.changeParseHostInfo(this.isServicesStarted(polledData));
  726. return;
  727. } else if (this.get('content.cluster.status') === 'PENDING') {
  728. this.setIsServicesInstalled(polledData);
  729. return;
  730. } else if (this.get('content.cluster.status') === 'INSTALL FAILED' || this.get('content.cluster.status') === 'START FAILED'
  731. || this.get('content.cluster.status') === 'STARTED') {
  732. this.set('progress', '100');
  733. this.changeParseHostInfo(true);
  734. return;
  735. }
  736. this.changeParseHostInfo(true);
  737. },
  738. /**
  739. * @param polledData Josn data retrieved from API
  740. * @returns {bool} Has "Start All Services" request completed successfully
  741. * @method isServicesStarted
  742. */
  743. isServicesStarted: function (polledData) {
  744. var clusterStatus = {};
  745. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  746. this.set('progress', '100');
  747. clusterStatus = {
  748. status: 'INSTALLED',
  749. requestId: this.get('content.cluster.requestId'),
  750. isCompleted: true
  751. };
  752. if (this.isSuccess(polledData)) {
  753. clusterStatus.status = 'STARTED';
  754. var serviceStartTime = App.dateTime();
  755. clusterStatus.installTime = ((parseInt(serviceStartTime) - parseInt(this.get('content.cluster.installStartTime'))) / 60000).toFixed(2);
  756. }
  757. else {
  758. clusterStatus.status = 'START FAILED'; // 'START FAILED' implies to step10 that installation was successful but start failed
  759. }
  760. this.saveClusterStatus(clusterStatus);
  761. this.saveInstalledHosts(this);
  762. return true;
  763. }
  764. this.changeParseHostInfo(false);
  765. },
  766. /**
  767. * @param polledData Json data retrieved from API
  768. * @method setIsServicesInstalled
  769. */
  770. setIsServicesInstalled: function (polledData) {
  771. var clusterStatus = {};
  772. if (!polledData.someProperty('Tasks.status', 'PENDING') && !polledData.someProperty('Tasks.status', 'QUEUED') && !polledData.someProperty('Tasks.status', 'IN_PROGRESS')) {
  773. clusterStatus = {
  774. status: 'PENDING',
  775. requestId: this.get('content.cluster.requestId'),
  776. isCompleted: false
  777. };
  778. if (this.get('status') === 'failed') {
  779. clusterStatus.status = 'INSTALL FAILED';
  780. this.saveClusterStatus(clusterStatus);
  781. this.set('progress', '100');
  782. this.get('hosts').forEach(function (host) {
  783. host.set('progress', '100');
  784. });
  785. this.isAllComponentsInstalled();
  786. } else {
  787. this.set('progress', '34');
  788. if (this.get('content.controllerName') === 'installerController') {
  789. this.isAllComponentsInstalled();
  790. this.saveInstalledHosts(this);
  791. this.changeParseHostInfo(true);
  792. return;
  793. } else {
  794. var self = this;
  795. this.launchStartServices(function () {
  796. self.saveInstalledHosts(self);
  797. self.changeParseHostInfo(true);
  798. });
  799. return;
  800. }
  801. }
  802. }
  803. this.changeParseHostInfo(false);
  804. },
  805. /**
  806. * This is done at HostRole level.
  807. * @param {Ember.Enumerable} tasksPerHost
  808. * @param {Object} host
  809. * @method setLogTasksStatePerHost
  810. */
  811. setLogTasksStatePerHost: function (tasksPerHost, host) {
  812. tasksPerHost.forEach(function (_task) {
  813. var task = host.logTasks.findProperty('Tasks.id', _task.Tasks.id);
  814. if (task) {
  815. task.Tasks.status = _task.Tasks.status;
  816. task.Tasks.start_time = _task.Tasks.start_time;
  817. task.Tasks.end_time = _task.Tasks.end_time;
  818. task.Tasks.exit_code = _task.Tasks.exit_code;
  819. } else {
  820. host.logTasks.pushObject(_task);
  821. }
  822. }, this);
  823. },
  824. /**
  825. * Parses the Json data retrieved from API and sets the task on the host of {hosts} array binded to template
  826. * @param polledData Json data retrieved from API
  827. * @method setParseHostInfo
  828. */
  829. setParseHostInfo: function (polledData) {
  830. console.log('TRACE: Entering host info function');
  831. var self = this;
  832. var totalProgress = 0;
  833. var tasksData = polledData.tasks;
  834. console.log("The value of tasksData is: ", tasksData);
  835. var requestId = this.get('content.cluster.requestId');
  836. tasksData.setEach('Tasks.request_id', requestId);
  837. if (polledData.Requests && polledData.Requests.id && polledData.Requests.id != requestId) {
  838. // We don't want to use non-current requestId's tasks data to
  839. // determine the current install status.
  840. // Also, we don't want to keep polling if it is not the
  841. // current requestId.
  842. this.changeParseHostInfo(false);
  843. return;
  844. }
  845. this.replacePolledData(tasksData);
  846. var tasksHostMap = {};
  847. tasksData.forEach(function (task) {
  848. if (tasksHostMap[task.Tasks.host_name]) {
  849. tasksHostMap[task.Tasks.host_name].push(task);
  850. } else {
  851. tasksHostMap[task.Tasks.host_name] = [task];
  852. }
  853. });
  854. this.get('hosts').forEach(function (_host) {
  855. var actionsPerHost = tasksHostMap[_host.name] || []; // retrieved from polled Data
  856. if (actionsPerHost.length === 0) {
  857. if (this.get('content.cluster.status') === 'PENDING' || this.get('content.cluster.status') === 'INSTALL FAILED') {
  858. _host.set('progress', '33');
  859. _host.set('isNoTasksForInstall', true);
  860. _host.set('status', 'pending');
  861. }
  862. if (this.get('content.cluster.status') === 'INSTALLED' || this.get('content.cluster.status') === 'FAILED') {
  863. _host.set('progress', '100');
  864. _host.set('status', 'success');
  865. }
  866. console.log("INFO: No task is hosted on the host");
  867. } else {
  868. _host.set('isNoTasksForInstall', false);
  869. }
  870. this.setLogTasksStatePerHost(actionsPerHost, _host);
  871. this.onSuccessPerHost(actionsPerHost, _host); // every action should be a success
  872. this.onErrorPerHost(actionsPerHost, _host); // any action should be a failure
  873. this.onInProgressPerHost(actionsPerHost, _host); // current running action for a host
  874. totalProgress += self.progressPerHost(actionsPerHost, _host);
  875. if (_host.get('progress') == '33' && _host.get('status') != 'failed' && _host.get('status') != 'warning') {
  876. _host.set('message', this.t('installer.step9.host.status.nothingToInstall'));
  877. _host.set('status', 'pending');
  878. }
  879. }, this);
  880. this.set('logTasksChangesCounter', this.get('logTasksChangesCounter') + 1);
  881. totalProgress = Math.floor(totalProgress / this.get('hosts.length'));
  882. this.set('progress', totalProgress.toString());
  883. console.log("INFO: right now the progress is: " + this.get('progress'));
  884. this.setFinishState(tasksData);
  885. },
  886. /**
  887. * Starts polling to the API
  888. * @method startPolling
  889. */
  890. startPolling: function () {
  891. this.set('isSubmitDisabled', true);
  892. this.doPolling();
  893. },
  894. /**
  895. * This function calls API just once to fetch log data of all tasks.
  896. * @method loadLogData
  897. */
  898. loadLogData: function (startPolling) {
  899. var requestsId = this.get('wizardController').getDBProperty('cluster').oldRequestsId;
  900. if (App.testMode) {
  901. this.set('POLL_INTERVAL', 1);
  902. }
  903. this.getLogsByRequest(!!startPolling, requestsId[requestsId.length-1]);
  904. },
  905. /**
  906. * Load form server <code>stderr, stdout</code> of current open task
  907. * @method loadCurrentTaskLog
  908. */
  909. loadCurrentTaskLog: function () {
  910. var taskId = this.get('currentOpenTaskId');
  911. var requestId = this.get('currentOpenTaskRequestId');
  912. var clusterName = this.get('content.cluster.name');
  913. if (!taskId) {
  914. console.log('taskId is null.');
  915. return;
  916. }
  917. App.ajax.send({
  918. name: 'background_operations.get_by_task',
  919. sender: this,
  920. data: {
  921. 'taskId': taskId,
  922. 'requestId': requestId,
  923. 'clusterName': clusterName
  924. },
  925. success: 'loadCurrentTaskLogSuccessCallback',
  926. error: 'loadCurrentTaskLogErrorCallback'
  927. });
  928. },
  929. /**
  930. * success callback function for getting log data of the opened task
  931. * @param {object} data
  932. * @method loadCurrentTaskLogSuccessCallback
  933. */
  934. loadCurrentTaskLogSuccessCallback: function (data) {
  935. var taskId = this.get('currentOpenTaskId');
  936. if (taskId) {
  937. var host = this.get('hosts').findProperty('name', data.Tasks.host_name);
  938. if (host) {
  939. var currentTask = host.get('logTasks').findProperty('Tasks.id', data.Tasks.id);
  940. if (currentTask) {
  941. currentTask.Tasks.stderr = data.Tasks.stderr;
  942. currentTask.Tasks.stdout = data.Tasks.stdout;
  943. }
  944. }
  945. }
  946. this.set('logTasksChangesCounter', this.get('logTasksChangesCounter') + 1);
  947. },
  948. /**
  949. * Error callback function for getting log data of the opened task
  950. * @method loadCurrentTaskLogErrorCallback
  951. */
  952. loadCurrentTaskLogErrorCallback: function () {
  953. this.set('currentOpenTaskId', 0);
  954. },
  955. /**
  956. * Function polls the API to retrieve data for the request.
  957. * @param {bool} polling whether to continue polling for status or not
  958. * @param {number} requestId
  959. * @method getLogsByRequest
  960. * @return {$.ajax|null}
  961. */
  962. getLogsByRequest: function (polling, requestId) {
  963. return App.ajax.send({
  964. name: 'wizard.step9.load_log',
  965. sender: this,
  966. data: {
  967. polling: polling,
  968. cluster: this.get('content.cluster.name'),
  969. requestId: requestId,
  970. numPolls: this.get('numPolls')
  971. },
  972. success: 'getLogsByRequestSuccessCallback',
  973. error: 'getLogsByRequestErrorCallback'
  974. }).retry({times: App.maxRetries, timeout: 3000}).then(null,
  975. function () {
  976. App.showReloadPopup();
  977. console.log('Install services all retries failed');
  978. }
  979. );
  980. },
  981. /**
  982. * Success callback for get log by request
  983. * @param {object} data
  984. * @param {object} opt
  985. * @param {object} params
  986. * @method getLogsByRequestSuccessCallback
  987. */
  988. getLogsByRequestSuccessCallback: function (data, opt, params) {
  989. var parsedData = jQuery.parseJSON(data);
  990. console.log("TRACE: In success function for the GET logs data");
  991. console.log("TRACE: Step9 -> The value is: ", parsedData);
  992. this.set('isPolling', params.polling);
  993. this.setParseHostInfo(parsedData);
  994. },
  995. /**
  996. * Error-callback for get log by request
  997. * @method getLogsByRequestErrorCallback
  998. */
  999. getLogsByRequestErrorCallback: function () {
  1000. this.loadLogData(true);
  1001. },
  1002. /**
  1003. * Delegates the function call to {getLogsByRequest} with appropriate params
  1004. * @method doPolling
  1005. */
  1006. doPolling: function () {
  1007. var requestId = this.get('content.cluster.requestId');
  1008. if (App.testMode) {
  1009. this.incrementProperty('numPolls');
  1010. }
  1011. this.getLogsByRequest(true, requestId);
  1012. },
  1013. /**
  1014. * Check that all components are in INSTALLED state before issuing start command
  1015. * @method isAllComponentsInstalled
  1016. * @return {$.ajax|null}
  1017. */
  1018. isAllComponentsInstalled: function () {
  1019. if (this.get('content.controllerName') !== 'installerController') {
  1020. return null;
  1021. }
  1022. var name = 'wizard.step9.installer.get_host_status';
  1023. return App.ajax.send({
  1024. name: name,
  1025. sender: this,
  1026. data: {
  1027. cluster: this.get('content.cluster.name')
  1028. },
  1029. success: 'isAllComponentsInstalledSuccessCallback',
  1030. error: 'isAllComponentsInstalledErrorCallback'
  1031. });
  1032. },
  1033. /**
  1034. * Success callback function for API checking host state and host_components state.
  1035. * @param {Object} jsonData
  1036. * @method isAllComponentsInstalledSuccessCallback
  1037. */
  1038. isAllComponentsInstalledSuccessCallback: function (jsonData) {
  1039. var clusterStatus = {
  1040. status: 'INSTALL FAILED',
  1041. isStartError: true,
  1042. isCompleted: false
  1043. };
  1044. var hostsWithHeartbeatLost = [];
  1045. jsonData.items.filterProperty('Hosts.host_state', 'HEARTBEAT_LOST').forEach(function (host) {
  1046. var hostComponentObj = {hostName: host.Hosts.host_name};
  1047. var componentArr = [];
  1048. host.host_components.forEach(function (_hostComponent) {
  1049. var componentName = App.format.role(_hostComponent.HostRoles.component_name);
  1050. componentArr.pushObject(componentName);
  1051. }, this);
  1052. hostComponentObj.componentNames = this.getComponentMessage(componentArr);
  1053. hostsWithHeartbeatLost.pushObject(hostComponentObj);
  1054. }, this);
  1055. this.set('hostsWithHeartbeatLost', hostsWithHeartbeatLost);
  1056. if (hostsWithHeartbeatLost.length) {
  1057. this.get('hosts').forEach(function (host) {
  1058. if (hostsWithHeartbeatLost.someProperty(('hostName'), host.get('name'))) {
  1059. host.set('status', 'heartbeat_lost');
  1060. } else if (host.get('status') !== 'failed' && host.get('status') !== 'warning') {
  1061. host.set('message', Em.I18n.t('installer.step9.host.status.startAborted'));
  1062. }
  1063. host.set('progress', '100');
  1064. });
  1065. this.set('progress', '100');
  1066. this.saveClusterStatus(clusterStatus);
  1067. } else if (this.get('content.cluster.status') === 'PENDING') {
  1068. this.launchStartServices();
  1069. }
  1070. },
  1071. /**
  1072. * Error callback function for API checking host state and host_components state
  1073. * @method isAllComponentsInstalledErrorCallback
  1074. */
  1075. isAllComponentsInstalledErrorCallback: function () {
  1076. var clusterStatus = {
  1077. status: 'INSTALL FAILED',
  1078. isStartError: true,
  1079. isCompleted: false
  1080. };
  1081. this.set('progress', '100');
  1082. this.get('hosts').forEach(function (host) {
  1083. if (host.get('status') !== 'failed' && host.get('status') !== 'warning') {
  1084. host.set('message', Em.I18n.t('installer.step9.host.status.startAborted'));
  1085. host.set('progress', '100');
  1086. }
  1087. });
  1088. this.saveClusterStatus(clusterStatus);
  1089. },
  1090. /**
  1091. * Get formatted string of components to display on the UI
  1092. * @param componentArr {Array} Array of components
  1093. * @returns {String}
  1094. * @method getComponentMessage
  1095. */
  1096. getComponentMessage: function (componentArr) {
  1097. var label = '';
  1098. componentArr.forEach(function (_component) {
  1099. if (componentArr.length === 1) {
  1100. label = _component;
  1101. }
  1102. else {
  1103. if (_component !== componentArr[componentArr.length - 1]) { // [clients.length - 1]
  1104. label = label + ' ' + _component;
  1105. if (_component !== componentArr[componentArr.length - 2]) {
  1106. label = label + ',';
  1107. }
  1108. }
  1109. else {
  1110. label = label + ' ' + Em.I18n.t('and') + ' ' + _component;
  1111. }
  1112. }
  1113. }, this);
  1114. return label.trim();
  1115. },
  1116. /**
  1117. * save cluster status in the parentController and localdb
  1118. * @param {object} clusterStatus
  1119. * @method saveClusterStatus
  1120. */
  1121. saveClusterStatus: function (clusterStatus) {
  1122. if (!App.testMode) {
  1123. App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
  1124. }
  1125. else {
  1126. this.set('content.cluster', clusterStatus);
  1127. }
  1128. },
  1129. /**
  1130. * save cluster status in the parentController and localdb
  1131. * @param {object} context
  1132. * @method saveInstalledHosts
  1133. */
  1134. saveInstalledHosts: function (context) {
  1135. if (!App.testMode) {
  1136. App.router.get(this.get('content.controllerName')).saveInstalledHosts(context);
  1137. }
  1138. }
  1139. });