step9_controller.js 43 KB

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