step8_controller.js 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. var stringUtils = require('utils/string_utils');
  20. var dataManipulationUtils = require('utils/data_manipulation');
  21. App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, App.wizardDeployProgressControllerMixin, App.ConfigOverridable, {
  22. name: 'wizardStep8Controller',
  23. /**
  24. * List of raw data about cluster that should be displayed
  25. * @type {Array}
  26. */
  27. rawContent: [
  28. {
  29. config_name: 'Admin',
  30. display_name: 'Admin Name',
  31. config_value: ''
  32. },
  33. {
  34. config_name: 'cluster',
  35. display_name: 'Cluster Name',
  36. config_value: ''
  37. },
  38. {
  39. config_name: 'hosts',
  40. display_name: 'Total Hosts',
  41. config_value: ''
  42. },
  43. {
  44. config_name: 'Repo',
  45. display_name: 'Local Repository',
  46. config_value: ''
  47. }
  48. ],
  49. /**
  50. * List of data about cluster (based on formatted <code>rawContent</code>)
  51. * @type {Object[]}
  52. */
  53. clusterInfo: [],
  54. /**
  55. * List of services with components assigned to hosts
  56. * @type {Object[]}
  57. */
  58. services: [],
  59. /**
  60. * @type {Object[]}
  61. */
  62. configs: [],
  63. /**
  64. * True if Kerberos is installed on the cluster and the kdc_type on the server is set to "none"
  65. * @type {Boolean}
  66. */
  67. isManualKerberos: Em.computed.equal('App.router.mainAdminKerberosController.kdc_type', 'none'),
  68. showDownloadCsv: function () {
  69. return !!App.get('router.mainAdminKerberosController.kdc_type')
  70. }.property('App.router.mainAdminKerberosController.kdc_type'),
  71. /**
  72. * Should Submit button be disabled
  73. * @type {bool}
  74. */
  75. isSubmitDisabled: false,
  76. /**
  77. * Should Back button be disabled
  78. * @type {bool}
  79. */
  80. isBackBtnDisabled: false,
  81. /**
  82. * Is error appears while <code>ajaxQueue</code> executes
  83. * @type {bool}
  84. */
  85. hasErrorOccurred: false,
  86. /**
  87. * Are services installed
  88. * Used to hide Deploy Progress Bar
  89. * @type {bool}
  90. */
  91. servicesInstalled: false,
  92. /**
  93. * List of service config tags
  94. * @type {Object[]}
  95. */
  96. serviceConfigTags: [],
  97. /**
  98. * Selected config group
  99. * @type {Object}
  100. */
  101. selectedConfigGroup: null,
  102. /**
  103. * List of config groups
  104. * @type {Object[]}
  105. */
  106. configGroups: [],
  107. /**
  108. * List of selected but not installed services
  109. * @type {Object[]}
  110. */
  111. selectedServices: function () {
  112. return this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false);
  113. }.property('content.services.@each.isSelected','content.services.@each.isInstalled').cacheable(),
  114. /**
  115. * List of installed services
  116. * @type {Object[]}
  117. */
  118. installedServices: Em.computed.filterBy('content.services', 'isInstalled', true),
  119. /**
  120. * Current cluster name
  121. * @type {string}
  122. */
  123. clusterName: Em.computed.alias('content.cluster.name'),
  124. /**
  125. * List of existing cluster names
  126. * @type {string[]}
  127. */
  128. clusterNames: [],
  129. /**
  130. * Number of completed cluster delete requests
  131. * @type {number}
  132. */
  133. clusterDeleteRequestsCompleted: 0,
  134. /**
  135. * Indicates if all cluster delete requests are completed
  136. * @type {boolean}
  137. */
  138. isAllClusterDeleteRequestsCompleted: Em.computed.equalProperties('clusterDeleteRequestsCompleted', 'clusterNames.length'),
  139. /**
  140. * Error popup body views for clusters that couldn't be deleted
  141. * @type {App.AjaxDefaultErrorPopupBodyView[]}
  142. */
  143. clusterDeleteErrorViews: [],
  144. /**
  145. * Clear current step data
  146. * @method clearStep
  147. */
  148. clearStep: function () {
  149. this.get('services').clear();
  150. this.get('configs').clear();
  151. this.get('clusterInfo').clear();
  152. this.get('serviceConfigTags').clear();
  153. this.set('servicesInstalled', false);
  154. this.set('ajaxQueueLength', 0);
  155. this.set('ajaxRequestsQueue', App.ajaxQueue.create());
  156. this.set('ajaxRequestsQueue.finishedCallback', this.ajaxQueueFinished);
  157. this.get('clusterDeleteErrorViews').clear();
  158. this.set('clusterDeleteRequestsCompleted', 0);
  159. },
  160. /**
  161. * Load current step data
  162. * @method loadStep
  163. */
  164. loadStep: function () {
  165. this.clearStep();
  166. if (this.get('content.serviceConfigProperties')) {
  167. this.formatProperties();
  168. this.loadConfigs();
  169. }
  170. this.loadClusterInfo();
  171. this.loadServices();
  172. this.set('isSubmitDisabled', false);
  173. this.set('isBackBtnDisabled', false);
  174. },
  175. /**
  176. * replace whitespace character with coma between directories
  177. * @method formatProperties
  178. */
  179. formatProperties: function () {
  180. this.get('content.serviceConfigProperties').forEach(function (_configProperty) {
  181. _configProperty.value = App.config.trimProperty(_configProperty, false);
  182. });
  183. },
  184. /**
  185. * Load all site properties
  186. * @method loadConfigs
  187. */
  188. loadConfigs: function () {
  189. //storedConfigs contains custom configs as well
  190. var configs = this.get('content.serviceConfigProperties');
  191. configs.forEach(function (_config) {
  192. _config.value = (typeof _config.value === "boolean") ? _config.value.toString() : _config.value;
  193. });
  194. var customGroupConfigs = [];
  195. var allConfigs = configs.filter(function (config) {
  196. if (config.group) {
  197. customGroupConfigs.push(config);
  198. return false;
  199. } else {
  200. return true;
  201. }
  202. });
  203. this.set('customNonDefaultGroupConfigs', customGroupConfigs);
  204. this.set('configs', allConfigs);
  205. },
  206. /**
  207. * Format <code>content.hosts</code> from Object to Array
  208. * @returns {Array}
  209. * @method getRegisteredHosts
  210. */
  211. getRegisteredHosts: function () {
  212. var allHosts = this.get('content.hosts');
  213. var hosts = [];
  214. for (var hostName in allHosts) {
  215. if (allHosts.hasOwnProperty(hostName)) {
  216. if (allHosts[hostName].bootStatus == 'REGISTERED') {
  217. allHosts[hostName].hostName = allHosts[hostName].name;
  218. hosts.pushObject(allHosts[hostName]);
  219. }
  220. }
  221. }
  222. return hosts;
  223. },
  224. /**
  225. * Load all info about cluster to <code>clusterInfo</code> variable
  226. * @method loadClusterInfo
  227. */
  228. loadClusterInfo: function () {
  229. //Admin name
  230. var admin = this.rawContent.findProperty('config_name', 'Admin');
  231. admin.config_value = App.db.getLoginName();
  232. if (admin.config_value) {
  233. this.get('clusterInfo').pushObject(Ember.Object.create(admin));
  234. }
  235. // cluster name
  236. var cluster = this.rawContent.findProperty('config_name', 'cluster');
  237. cluster.config_value = this.get('content.cluster.name');
  238. this.get('clusterInfo').pushObject(Ember.Object.create(cluster));
  239. //hosts
  240. var newHostsCount = 0;
  241. var totalHostsCount = 0;
  242. var hosts = this.get('content.hosts');
  243. for (var hostName in hosts) {
  244. newHostsCount += ~~(!hosts[hostName].isInstalled);
  245. totalHostsCount++;
  246. }
  247. var totalHostsObj = this.rawContent.findProperty('config_name', 'hosts');
  248. totalHostsObj.config_value = totalHostsCount + ' (' + newHostsCount + ' new)';
  249. this.get('clusterInfo').pushObject(Em.Object.create(totalHostsObj));
  250. //repo
  251. if (['addHostController', 'addServiceController'].contains(this.get('content.controllerName'))) {
  252. // For some stacks there is no info regarding stack versions to upgrade, e.g. HDP-2.1
  253. if (App.StackVersion.find().get('content.length')) {
  254. this.loadRepoInfo();
  255. } else {
  256. this.loadDefaultRepoInfo();
  257. }
  258. } else {
  259. // from install wizard
  260. var selectedStack = App.Stack.find().findProperty('isSelected');
  261. var allRepos = [];
  262. if (selectedStack && selectedStack.get('operatingSystems')) {
  263. selectedStack.get('operatingSystems').forEach(function (os) {
  264. if (os.get('isSelected')) {
  265. os.get('repositories').forEach(function(repo) {
  266. allRepos.push(Em.Object.create({
  267. base_url: repo.get('baseUrl'),
  268. os_type: repo.get('osType'),
  269. repo_id: repo.get('repoId')
  270. }));
  271. }, this);
  272. }
  273. }, this);
  274. }
  275. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  276. this.get('clusterInfo').set('repoInfo', allRepos);
  277. }
  278. },
  279. /**
  280. * Load repo info for add Service/Host wizard review page
  281. * @return {$.ajax|null}
  282. * @method loadRepoInfo
  283. */
  284. loadRepoInfo: function () {
  285. var currentRepoVersion = App.StackVersion.find().findProperty('state', 'CURRENT').get('repositoryVersion.repositoryVersion');
  286. var stackName = App.get('currentStackName');
  287. return App.ajax.send({
  288. name: 'cluster.load_repo_version',
  289. sender: this,
  290. data: {
  291. stackName: stackName,
  292. repositoryVersion: currentRepoVersion
  293. },
  294. success: 'loadRepoInfoSuccessCallback',
  295. error: 'loadRepoInfoErrorCallback'
  296. });
  297. },
  298. /**
  299. * Save all repo base URL of all OS type to <code>repoInfo<code>
  300. * @param {object} data
  301. * @method loadRepoInfoSuccessCallback
  302. */
  303. loadRepoInfoSuccessCallback: function (data) {
  304. Em.assert('Current repo-version may be only one', data.items.length === 1);
  305. if (data.items.length) {
  306. var allRepos = this.generateRepoInfo(Em.getWithDefault(data, 'items.0.repository_versions.0.operating_systems', []));
  307. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  308. this.get('clusterInfo').set('repoInfo', allRepos);
  309. } else {
  310. this.loadDefaultRepoInfo();
  311. }
  312. },
  313. /**
  314. * Generate list regarding info about OS versions and repositories.
  315. *
  316. * @param {Object{}} oses - OS array
  317. * @returns {Em.Object[]}
  318. */
  319. generateRepoInfo: function(oses) {
  320. return oses.map(function(os) {
  321. return os.repositories.map(function (repository) {
  322. return Em.Object.create({
  323. base_url: repository.Repositories.base_url,
  324. os_type: repository.Repositories.os_type,
  325. repo_id: repository.Repositories.repo_id
  326. });
  327. });
  328. }).reduce(function(p, c) { return p.concat(c); });
  329. },
  330. /**
  331. * Load repo info from stack. Used if installed stack doesn't have upgrade info.
  332. *
  333. * @returns {$.Deferred}
  334. * @method loadDefaultRepoInfo
  335. */
  336. loadDefaultRepoInfo: function() {
  337. var nameVersionCombo = App.get('currentStackVersion').split('-');
  338. return App.ajax.send({
  339. name: 'cluster.load_repositories',
  340. sender: this,
  341. data: {
  342. stackName: nameVersionCombo[0],
  343. stackVersion: nameVersionCombo[1]
  344. },
  345. success: 'loadDefaultRepoInfoSuccessCallback',
  346. error: 'loadRepoInfoErrorCallback'
  347. });
  348. },
  349. /**
  350. * @param {Object} data - JSON data from server
  351. * @method loadDefaultRepoInfoSuccessCallback
  352. */
  353. loadDefaultRepoInfoSuccessCallback: function (data) {
  354. var allRepos = this.generateRepoInfo(Em.getWithDefault(data, 'items', []));
  355. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  356. this.get('clusterInfo').set('repoInfo', allRepos);
  357. },
  358. /**
  359. * @param {object} request
  360. * @method loadRepoInfoErrorCallback
  361. */
  362. loadRepoInfoErrorCallback: function (request) {
  363. var allRepos = [];
  364. allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
  365. this.get('clusterInfo').set('repoInfo', allRepos);
  366. },
  367. /**
  368. * Load all info about services to <code>services</code> variable
  369. * @method loadServices
  370. */
  371. loadServices: function () {
  372. this.get('selectedServices').filterProperty('isHiddenOnSelectServicePage', false).forEach(function (service) {
  373. var serviceObj = Em.Object.create({
  374. service_name: service.get('serviceName'),
  375. display_name: service.get('displayNameOnSelectServicePage'),
  376. service_components: Em.A([])
  377. });
  378. service.get('serviceComponents').forEach(function (component) {
  379. // show clients for services that have only clients components
  380. if ((component.get('isClient') || component.get('isRequiredOnAllHosts')) && !service.get('isClientOnlyService')) return;
  381. // skip components that was hide on assign master page
  382. if (component.get('isMaster') && !component.get('isShownOnInstallerAssignMasterPage')) return;
  383. // no HA component
  384. if (component.get('isHAComponentOnly')) return;
  385. // skip if component is not allowed on single node cluster
  386. if (Object.keys(this.get('content.hosts')).length == 1 && component.get('isNotAllowedOnSingleNodeCluster')) return;
  387. var displayName;
  388. if (component.get('isClient')) {
  389. displayName = Em.I18n.t('common.clients')
  390. } else {
  391. // remove service name from component display name
  392. displayName = App.format.role(component.get('componentName')).replace(new RegExp('^' + service.get('serviceName') + '\\s', 'i'), '');
  393. }
  394. serviceObj.get('service_components').pushObject(Em.Object.create({
  395. component_name: component.get('isClient') ? Em.I18n.t('common.client').toUpperCase() : component.get('componentName'),
  396. display_name: displayName,
  397. component_value: this.assignComponentHosts(component)
  398. }));
  399. }, this);
  400. if (service.get('customReviewHandler')) {
  401. for (var displayName in service.get('customReviewHandler')) {
  402. serviceObj.get('service_components').pushObject(Em.Object.create({
  403. display_name: displayName,
  404. component_value: this.assignComponentHosts(Em.Object.create({
  405. customHandler: service.get('customReviewHandler.' + displayName)
  406. }))
  407. }));
  408. }
  409. }
  410. this.get('services').pushObject(serviceObj);
  411. }, this);
  412. },
  413. /**
  414. * Set <code>component_value</code> property to <code>component</code>
  415. * @param {Em.Object} component
  416. * @return {String}
  417. * @method assignComponentHosts
  418. */
  419. assignComponentHosts: function (component) {
  420. var componentValue;
  421. if (component.get('customHandler')) {
  422. componentValue = this[component.get('customHandler')].call(this, component);
  423. }
  424. else {
  425. if (component.get('isMaster')) {
  426. componentValue = this.getMasterComponentValue(component.get('componentName'));
  427. }
  428. else {
  429. var componentName = component.get('isClient') ? Em.I18n.t('common.client').toUpperCase() : component.get('componentName');
  430. var hostsLength = this.get('content.slaveComponentHosts')
  431. .findProperty('componentName', componentName).hosts.length;
  432. componentValue = hostsLength + Em.I18n.t('installer.step8.host' + ((hostsLength > 1) ? 's' : ''));
  433. }
  434. }
  435. return componentValue;
  436. },
  437. getMasterComponentValue: function (componentName) {
  438. var masterComponents = this.get('content.masterComponentHosts');
  439. var hostsCount = masterComponents.filterProperty('component', componentName).length;
  440. return stringUtils.pluralize(hostsCount,
  441. masterComponents.findProperty('component', componentName).hostName,
  442. hostsCount + ' ' + Em.I18n.t('installer.step8.hosts'));
  443. },
  444. loadHiveDbValue: function() {
  445. return this.loadDbValue('HIVE');
  446. },
  447. loadOozieDbValue: function() {
  448. return this.loadDbValue('OOZIE');
  449. },
  450. /**
  451. * Set displayed Hive DB value based on DB type
  452. * @method loadHiveDbValue
  453. */
  454. loadDbValue: function (serviceName) {
  455. var serviceConfigProperties = this.get('wizardController').getDBProperty('serviceConfigProperties');
  456. var dbFull = serviceConfigProperties.findProperty('name', serviceName.toLowerCase() + '_database'),
  457. db = serviceConfigProperties.findProperty('name', serviceName.toLowerCase() + '_ambari_database');
  458. return db && dbFull ? db.value + ' (' + dbFull.value + ')' : '';
  459. },
  460. /**
  461. * Set displayed HBase master value
  462. * @param {Object} hbaseMaster
  463. * @method loadHbaseMasterValue
  464. */
  465. loadHbaseMasterValue: function (hbaseMaster) {
  466. var hbaseHostName = this.get('content.masterComponentHosts').filterProperty('component', hbaseMaster.component_name);
  467. if (hbaseHostName.length == 1) {
  468. hbaseMaster.set('component_value', hbaseHostName[0].hostName);
  469. } else {
  470. hbaseMaster.set('component_value', hbaseHostName[0].hostName + " " + Em.I18n.t('installer.step8.other').format(hbaseHostName.length - 1));
  471. }
  472. },
  473. /**
  474. * Set displayed ZooKeeper Server value
  475. * @param {Object} serverComponent
  476. * @method loadZkServerValue
  477. */
  478. loadZkServerValue: function (serverComponent) {
  479. var zkHostNames = this.get('content.masterComponentHosts').filterProperty('component', serverComponent.component_name).length;
  480. var hostSuffix;
  481. if (zkHostNames === 1) {
  482. hostSuffix = Em.I18n.t('installer.step8.host');
  483. } else {
  484. hostSuffix = Em.I18n.t('installer.step8.hosts');
  485. }
  486. serverComponent.set('component_value', zkHostNames + hostSuffix);
  487. },
  488. /**
  489. * Onclick handler for <code>next</code> button
  490. * @method submit
  491. * @return {void}
  492. */
  493. submit: function () {
  494. var wizardController;
  495. if (!this.get('isSubmitDisabled')) {
  496. wizardController = App.router.get(this.get('content.controllerName'));
  497. wizardController.setLowerStepsDisable(wizardController.get('currentStep'));
  498. this.set('isSubmitDisabled', true);
  499. this.set('isBackBtnDisabled', true);
  500. this.showRestartWarnings()
  501. .then(this.checkKDCSession.bind(this));
  502. }
  503. },
  504. /**
  505. * Warn user about services that will be restarted during installation.
  506. *
  507. * @returns {$.Deferred}
  508. */
  509. showRestartWarnings: function() {
  510. var self = this;
  511. var dfd = $.Deferred();
  512. var wizardController = App.router.get(this.get('content.controllerName'));
  513. var selectedServiceNames = this.get('selectedServices').mapProperty('serviceName');
  514. var installedServiceNames = this.get('installedServices').mapProperty('serviceName');
  515. if (this.get('content.controllerName') === 'addServiceController' && selectedServiceNames.contains('OOZIE')) {
  516. var affectedServices = ['HDFS', 'YARN'].filter(function(serviceName) {
  517. return installedServiceNames.contains(serviceName);
  518. });
  519. if (affectedServices.length) {
  520. var serviceNames = affectedServices.length > 1 ?
  521. '<b>{0}</b> {1} <b>{2}</b>'.format(affectedServices[0], Em.I18n.t('and'), affectedServices[1]) : '<b>' + affectedServices[0] + '</b> ';
  522. App.ModalPopup.show({
  523. encodeBody: false,
  524. header: Em.I18n.t('common.warning'),
  525. body: Em.I18n.t('installer.step8.services.restart.required').format(serviceNames, stringUtils.pluralize(affectedServices.length, Em.I18n.t('common.service').toLowerCase())),
  526. secondary: Em.I18n.t('common.cancel'),
  527. primary: Em.I18n.t('common.proceedAnyway'),
  528. onPrimary: function() {
  529. this.hide();
  530. dfd.resolve();
  531. },
  532. onClose: function() {
  533. this.hide();
  534. self.set('isSubmitDisabled', false);
  535. self.set('isBackBtnDisabled', false);
  536. wizardController.setStepsEnable();
  537. dfd.reject();
  538. },
  539. onSecondary: function() {
  540. this.onClose();
  541. }
  542. });
  543. } else {
  544. dfd.resolve();
  545. }
  546. } else {
  547. dfd.resolve();
  548. }
  549. return dfd.promise();
  550. },
  551. checkKDCSession: function() {
  552. var self = this;
  553. var wizardController = App.router.get(this.get('content.controllerName'));
  554. if (this.get('content.controllerName') != 'installerController') {
  555. App.get('router.mainAdminKerberosController').getKDCSessionState(this.submitProceed.bind(this), function () {
  556. self.set('isSubmitDisabled', false);
  557. self.set('isBackBtnDisabled', false);
  558. wizardController.setStepsEnable();
  559. if (self.get('content.controllerName') === 'addServiceController') {
  560. wizardController.setSkipSlavesStep(wizardController.getDBProperty('selectedServiceNames'), 3);
  561. }
  562. });
  563. } else {
  564. this.submitProceed();
  565. }
  566. },
  567. /**
  568. * Update configurations for installed services.
  569. * Do separated PUT-request for each siteName for each service
  570. *
  571. * @param {Array} fileNamesToUpdate - file names that should be updated
  572. * @method updateConfigurations
  573. */
  574. updateConfigurations: function (fileNamesToUpdate) {
  575. var configurationController = App.router.get('mainServiceInfoConfigsController');
  576. var configs = this.get('configs').slice(0);
  577. var configsMap = [];
  578. fileNamesToUpdate.forEach(function (fileName) {
  579. // TODO - Temporarily commented out before refactoring should clean it more properly
  580. // if (!fileName || /^(core)/.test(fileName)) return;
  581. var tagName = 'version' + (new Date).getTime();
  582. var configsToSave = configs.filterProperty('filename', fileName);
  583. configsToSave.forEach(function (item) {
  584. item.value = App.config.trimProperty(item, false);
  585. });
  586. configsMap.push(configurationController.createSiteObj(fileName.replace(".xml", ""), tagName, configsToSave));
  587. }, this);
  588. if (!configsMap.length) return;
  589. this.applyConfigurationsToCluster(configsMap);
  590. },
  591. /**
  592. * Prepare <code>ajaxQueue</code> and start to execute it
  593. * @method submitProceed
  594. */
  595. submitProceed: function () {
  596. var self = this;
  597. this.set('clusterDeleteRequestsCompleted', 0);
  598. this.get('clusterDeleteErrorViews').clear();
  599. if (this.get('content.controllerName') == 'addHostController') {
  600. App.router.get('addHostController').setLowerStepsDisable(4);
  601. }
  602. // checkpoint the cluster status on the server so that the user can resume from where they left off
  603. switch (this.get('content.controllerName')) {
  604. case 'installerController':
  605. App.clusterStatus.setClusterStatus({
  606. clusterName: this.get('clusterName'),
  607. clusterState: 'CLUSTER_DEPLOY_PREP_2',
  608. wizardControllerName: this.get('content.controllerName'),
  609. localdb: App.db.data
  610. });
  611. break;
  612. case 'addHostController':
  613. App.clusterStatus.setClusterStatus({
  614. clusterName: this.get('clusterName'),
  615. clusterState: 'ADD_HOSTS_DEPLOY_PREP_2',
  616. wizardControllerName: this.get('content.controllerName'),
  617. localdb: App.db.data
  618. });
  619. break;
  620. case 'addServiceController':
  621. App.clusterStatus.setClusterStatus({
  622. clusterName: this.get('clusterName'),
  623. clusterState: 'ADD_SERVICES_DEPLOY_PREP_2',
  624. wizardControllerName: this.get('content.controllerName'),
  625. localdb: App.db.data
  626. });
  627. break;
  628. default:
  629. break;
  630. }
  631. // delete any existing clusters to start from a clean slate
  632. // before creating a new cluster in install wizard
  633. // TODO: modify for multi-cluster support
  634. this.getExistingClusterNames().complete(function () {
  635. var clusterNames = self.get('clusterNames');
  636. if (self.get('content.controllerName') == 'installerController' && (!App.get('testMode')) && clusterNames.length) {
  637. self.deleteClusters(clusterNames);
  638. } else {
  639. self.startDeploy();
  640. }
  641. });
  642. },
  643. /**
  644. * Get list of existing cluster names
  645. * @returns {object|null}
  646. * returns an array of existing cluster names.
  647. * returns an empty array if there are no existing clusters.
  648. * @method getExistingClusterNames
  649. */
  650. getExistingClusterNames: function () {
  651. return App.ajax.send({
  652. name: 'wizard.step8.existing_cluster_names',
  653. sender: this,
  654. success: 'getExistingClusterNamesSuccessCallBack',
  655. error: 'getExistingClusterNamesErrorCallback'
  656. });
  657. },
  658. /**
  659. * Save received list to <code>clusterNames</code>
  660. * @param {Object} data
  661. * @method getExistingClusterNamesSuccessCallBack
  662. */
  663. getExistingClusterNamesSuccessCallBack: function (data) {
  664. var clusterNames = data.items.mapProperty('Clusters.cluster_name');
  665. this.set('clusterNames', clusterNames);
  666. },
  667. /**
  668. * If error appears, set <code>clusterNames</code> to <code>[]</code>
  669. * @method getExistingClusterNamesErrorCallback
  670. */
  671. getExistingClusterNamesErrorCallback: function () {
  672. this.set('clusterNames', []);
  673. },
  674. /**
  675. * Delete cluster by name
  676. * One request for one cluster!
  677. * @param {string[]} clusterNames
  678. * @method deleteClusters
  679. */
  680. deleteClusters: function (clusterNames) {
  681. this.get('clusterDeleteErrorViews').clear();
  682. clusterNames.forEach(function (clusterName, index) {
  683. App.ajax.send({
  684. name: 'common.delete.cluster',
  685. sender: this,
  686. data: {
  687. name: clusterName,
  688. isLast: index == clusterNames.length - 1
  689. },
  690. success: 'deleteClusterSuccessCallback',
  691. error: 'deleteClusterErrorCallback'
  692. });
  693. }, this);
  694. },
  695. /**
  696. * Method to execute after successful cluster deletion
  697. * @method deleteClusterSuccessCallback
  698. */
  699. deleteClusterSuccessCallback: function () {
  700. this.incrementProperty('clusterDeleteRequestsCompleted');
  701. if (this.get('isAllClusterDeleteRequestsCompleted')) {
  702. if (this.get('clusterDeleteErrorViews.length')) {
  703. this.showDeleteClustersErrorPopup();
  704. } else {
  705. this.startDeploy();
  706. }
  707. }
  708. },
  709. /**
  710. * Method to execute after failed cluster deletion
  711. * @param {object} request
  712. * @param {string} ajaxOptions
  713. * @param {string} error
  714. * @param {object} opt
  715. * @method deleteClusterErrorCallback
  716. */
  717. deleteClusterErrorCallback: function (request, ajaxOptions, error, opt) {
  718. this.incrementProperty('clusterDeleteRequestsCompleted');
  719. try {
  720. var json = $.parseJSON(request.responseText);
  721. var message = json.message;
  722. } catch (err) {
  723. }
  724. this.get('clusterDeleteErrorViews').pushObject(App.AjaxDefaultErrorPopupBodyView.create({
  725. url: opt.url,
  726. type: opt.type,
  727. status: request.status,
  728. message: message
  729. }));
  730. if (this.get('isAllClusterDeleteRequestsCompleted')) {
  731. this.showDeleteClustersErrorPopup();
  732. }
  733. },
  734. /**
  735. * Show error popup if cluster deletion failed
  736. * @method showDeleteClustersErrorPopup
  737. */
  738. showDeleteClustersErrorPopup: function () {
  739. var self = this;
  740. this.setProperties({
  741. isSubmitDisabled: false,
  742. isBackBtnDisabled: false
  743. });
  744. App.ModalPopup.show({
  745. header: Em.I18n.t('common.error'),
  746. secondary: false,
  747. onPrimary: function () {
  748. this.hide();
  749. },
  750. bodyClass: Em.ContainerView.extend({
  751. childViews: self.get('clusterDeleteErrorViews')
  752. })
  753. });
  754. },
  755. /**
  756. * updates kerberosDescriptorConfigs
  757. * @method updateKerberosDescriptor
  758. */
  759. updateKerberosDescriptor: function(instant) {
  760. var kerberosDescriptor = App.db.get('KerberosWizard', 'kerberosDescriptorConfigs');
  761. var descriptorExists = this.get('wizardController').getDBProperty('isClusterDescriptorExists') === true;
  762. var ajaxOpts = {
  763. name: descriptorExists ? 'admin.kerberos.cluster.artifact.update' : 'admin.kerberos.cluster.artifact.create',
  764. data: {
  765. artifactName: 'kerberos_descriptor',
  766. data: {
  767. artifact_data: kerberosDescriptor
  768. }
  769. }
  770. };
  771. if (instant) {
  772. ajaxOpts.sender = this;
  773. App.ajax.send(ajaxOpts);
  774. } else {
  775. this.addRequestToAjaxQueue(ajaxOpts);
  776. }
  777. },
  778. /**
  779. * Start deploy process
  780. * @method startDeploy
  781. */
  782. startDeploy: function () {
  783. this.createCluster();
  784. this.createSelectedServices();
  785. if (this.get('content.controllerName') !== 'addHostController') {
  786. if (this.get('content.controllerName') === 'addServiceController') {
  787. // for manually enabled Kerberos descriptor was updated on transition to this step
  788. if (App.get('isKerberosEnabled') && !this.get('isManualKerberos')) {
  789. this.updateKerberosDescriptor();
  790. }
  791. var fileNamesToUpdate = this.get('wizardController').getDBProperty('fileNamesToUpdate').uniq();
  792. if (fileNamesToUpdate && fileNamesToUpdate.length) {
  793. this.updateConfigurations(fileNamesToUpdate);
  794. }
  795. }
  796. this.createConfigurations();
  797. this.applyConfigurationsToCluster(this.get('serviceConfigTags'));
  798. }
  799. this.createComponents();
  800. this.registerHostsToCluster();
  801. this.createConfigurationGroups();
  802. this.createMasterHostComponents();
  803. this.createSlaveAndClientsHostComponents();
  804. if (this.get('content.controllerName') === 'addServiceController') {
  805. this.createAdditionalClientComponents();
  806. }
  807. this.createAdditionalHostComponents();
  808. this.set('ajaxQueueLength', this.get('ajaxRequestsQueue.queue.length'));
  809. this.get('ajaxRequestsQueue').start();
  810. this.showLoadingIndicator();
  811. },
  812. /**
  813. * *******************************************************************
  814. * The following create* functions are called upon submitting Step 8.
  815. * *******************************************************************
  816. */
  817. /**
  818. * Create cluster using selected stack version
  819. * Queued request
  820. * @method createCluster
  821. */
  822. createCluster: function () {
  823. if (this.get('content.controllerName') !== 'installerController') return;
  824. var stackVersion = (this.get('content.installOptions.localRepo')) ? App.currentStackVersion.replace(/(-\d+(\.\d)*)/ig, "Local$&") : App.currentStackVersion;
  825. this.addRequestToAjaxQueue({
  826. name: 'wizard.step8.create_cluster',
  827. data: {
  828. data: JSON.stringify({ "Clusters": {"version": stackVersion }})
  829. },
  830. success: 'createClusterSuccess'
  831. });
  832. },
  833. createClusterSuccess: function (data, xhr, params) {
  834. App.set('clusterName', params.cluster)
  835. },
  836. /**
  837. * Create selected to install services
  838. * Queued request
  839. * Skipped if no services where selected!
  840. * @method createSelectedServices
  841. */
  842. createSelectedServices: function () {
  843. var data = this.createSelectedServicesData();
  844. if (!data.length) return;
  845. this.addRequestToAjaxQueue({
  846. name: 'wizard.step8.create_selected_services',
  847. data: {
  848. data: JSON.stringify(data)
  849. }
  850. });
  851. },
  852. /**
  853. * Format data for <code>createSelectedServices</code> request
  854. * @returns {Object[]}
  855. * @method createSelectedServicesData
  856. */
  857. createSelectedServicesData: function () {
  858. return this.get('selectedServices').map(function (_service) {
  859. return {"ServiceInfo": { "service_name": _service.get('serviceName') }};
  860. });
  861. },
  862. /**
  863. * Create components for selected services
  864. * Queued requests
  865. * One request for each service!
  866. * @method createComponents
  867. */
  868. createComponents: function () {
  869. var serviceComponents = App.StackServiceComponent.find();
  870. this.get('selectedServices').forEach(function (_service) {
  871. var serviceName = _service.get('serviceName');
  872. var componentsData = serviceComponents.filterProperty('serviceName', serviceName).map(function (_component) {
  873. return { "ServiceComponentInfo": { "component_name": _component.get('componentName') } };
  874. });
  875. // Service must be specified in terms of a query for creating multiple components at the same time.
  876. // See AMBARI-1018.
  877. this.addRequestToCreateComponent(componentsData, serviceName);
  878. }, this);
  879. if (this.get('content.controllerName') === 'addHostController') {
  880. var allServiceComponents = [];
  881. var services = App.Service.find().mapProperty('serviceName');
  882. services.forEach(function(_service){
  883. var _serviceComponents = App.Service.find(_service).get('serviceComponents');
  884. allServiceComponents = allServiceComponents.concat(_serviceComponents);
  885. }, this);
  886. this.get('content.slaveComponentHosts').forEach(function (component) {
  887. if (component.componentName !== 'CLIENT' && !allServiceComponents.contains(component.componentName)) {
  888. this.addRequestToCreateComponent(
  889. [{"ServiceComponentInfo": {"component_name": component.componentName}}],
  890. App.StackServiceComponent.find().findProperty('componentName', component.componentName).get('serviceName')
  891. );
  892. }
  893. }, this);
  894. this.get('content.clients').forEach(function (component) {
  895. if (!allServiceComponents.contains(component.component_name)) {
  896. this.addRequestToCreateComponent(
  897. [{"ServiceComponentInfo": {"component_name": component.component_name}}],
  898. App.StackServiceComponent.find().findProperty('componentName', component.component_name).get('serviceName')
  899. );
  900. }
  901. }, this);
  902. }
  903. },
  904. /**
  905. * Add request to ajax queue to create service component
  906. * @param componentsData
  907. * @param serviceName
  908. */
  909. addRequestToCreateComponent: function (componentsData, serviceName) {
  910. this.addRequestToAjaxQueue({
  911. name: 'wizard.step8.create_components',
  912. data: {
  913. data: JSON.stringify({"components": componentsData}),
  914. serviceName: serviceName
  915. }
  916. });
  917. },
  918. /**
  919. * Error callback for new service component request
  920. * So, if component doesn't exist we should create it
  921. * @param {object} request
  922. * @param {object} ajaxOptions
  923. * @param {string} error
  924. * @param {object} opt
  925. * @param {object} params
  926. * @method newServiceComponentErrorCallback
  927. */
  928. newServiceComponentErrorCallback: function (request, ajaxOptions, error, opt, params) {
  929. this.addRequestToAjaxQueue({
  930. name: 'wizard.step8.create_components',
  931. data: {
  932. serviceName: params.serviceName,
  933. data: JSON.stringify({
  934. "components": [
  935. {
  936. "ServiceComponentInfo": {
  937. "component_name": params.componentName
  938. }
  939. }
  940. ]
  941. })
  942. }
  943. });
  944. },
  945. /**
  946. * Register hosts
  947. * Queued request
  948. * @method registerHostsToCluster
  949. */
  950. registerHostsToCluster: function () {
  951. var data = this.createRegisterHostData();
  952. if (!data.length) return;
  953. this.addRequestToAjaxQueue({
  954. name: 'wizard.step8.register_host_to_cluster',
  955. data: {
  956. data: JSON.stringify(data)
  957. }
  958. });
  959. },
  960. /**
  961. * Format request-data for <code>registerHostsToCluster</code>
  962. * @returns {Object}
  963. * @method createRegisterHostData
  964. */
  965. createRegisterHostData: function () {
  966. return this.getRegisteredHosts().filterProperty('isInstalled', false).map(function (host) {
  967. return {"Hosts": { "host_name": host.hostName}};
  968. });
  969. },
  970. /**
  971. * Register new master components
  972. * @uses registerHostsToComponent
  973. * @method createMasterHostComponents
  974. */
  975. createMasterHostComponents: function () {
  976. var masterOnAllHosts = [];
  977. this.get('content.services').filterProperty('isSelected').forEach(function (service) {
  978. service.get('serviceComponents').filterProperty('isRequiredOnAllHosts').forEach(function (component) {
  979. if (component.get('isMaster')) {
  980. masterOnAllHosts.push(component.get('componentName'));
  981. }
  982. }, this);
  983. }, this);
  984. // create master components for only selected services.
  985. var selectedMasterComponents = this.get('content.masterComponentHosts').filter(function (_component) {
  986. return this.get('selectedServices').mapProperty('serviceName').contains(_component.serviceId)
  987. }, this);
  988. selectedMasterComponents.mapProperty('component').uniq().forEach(function (component) {
  989. if (masterOnAllHosts.length > 0) {
  990. var compOnAllHosts = false;
  991. for (var i=0; i < masterOnAllHosts.length; i++) {
  992. if (component.component_name == masterOnAllHosts[i]) {
  993. compOnAllHosts = true;
  994. break;
  995. }
  996. }
  997. if (!compOnAllHosts) {
  998. var hostNames = selectedMasterComponents.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
  999. this.registerHostsToComponent(hostNames, component);
  1000. }
  1001. } else {
  1002. var hostNames = selectedMasterComponents.filterProperty('component', component).filterProperty('isInstalled', false).mapProperty('hostName');
  1003. this.registerHostsToComponent(hostNames, component);
  1004. }
  1005. }, this);
  1006. },
  1007. getClientsMap: function (flag) {
  1008. var clientNames = App.StackServiceComponent.find().filterProperty('isClient').mapProperty('componentName'),
  1009. clientsMap = {},
  1010. dependedComponents = flag ? App.StackServiceComponent.find().filterProperty(flag) : App.StackServiceComponent.find();
  1011. clientNames.forEach(function (clientName) {
  1012. clientsMap[clientName] = Em.A([]);
  1013. dependedComponents.forEach(function (component) {
  1014. if (component.get('dependencies').mapProperty('componentName').contains(clientName)) clientsMap[clientName].push(component.get('componentName'));
  1015. });
  1016. if (!clientsMap[clientName].length) delete clientsMap[clientName];
  1017. });
  1018. return clientsMap;
  1019. },
  1020. /**
  1021. * Register slave components and clients
  1022. * @uses registerHostsToComponent
  1023. * @method createSlaveAndClientsHostComponents
  1024. */
  1025. createSlaveAndClientsHostComponents: function () {
  1026. var masterHosts = this.get('content.masterComponentHosts');
  1027. var slaveHosts = this.get('content.slaveComponentHosts');
  1028. var clients = this.get('content.clients').filterProperty('isInstalled', false);
  1029. var slaveOnAllHosts = [];
  1030. var clientOnAllHosts = [];
  1031. this.get('content.services').filterProperty('isSelected').forEach(function (service) {
  1032. service.get('serviceComponents').filterProperty('isRequiredOnAllHosts').forEach(function (component) {
  1033. if (component.get('isClient')) {
  1034. clientOnAllHosts.push(component.get('componentName'));
  1035. } else if (component.get('isSlave')) {
  1036. slaveOnAllHosts.push(component.get('componentName'));
  1037. }
  1038. }, this);
  1039. }, this);
  1040. /**
  1041. * Determines on which hosts client should be installed (based on availability of master components on hosts)
  1042. * @type {Object}
  1043. * Format:
  1044. * <code>
  1045. * {
  1046. * CLIENT1: Em.A([MASTER1, MASTER2, ...]),
  1047. * CLIENT2: Em.A([MASTER3, MASTER1, ...])
  1048. * ...
  1049. * }
  1050. * </code>
  1051. */
  1052. var clientsToMasterMap = this.getClientsMap('isMaster');
  1053. slaveHosts.forEach(function (_slave) {
  1054. if (_slave.componentName !== 'CLIENT') {
  1055. if (slaveOnAllHosts.length > 0) {
  1056. var compOnAllHosts = false;
  1057. for (var i=0; i < slaveOnAllHosts.length; i++) {
  1058. if (_slave.component_name == slaveOnAllHosts[i]) {
  1059. // component with ALL cardinality should not
  1060. // registerHostsToComponent in createSlaveAndClientsHostComponents
  1061. compOnAllHosts = true;
  1062. break;
  1063. }
  1064. }
  1065. if (!compOnAllHosts) {
  1066. var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
  1067. this.registerHostsToComponent(hostNames, _slave.componentName);
  1068. }
  1069. } else {
  1070. var hostNames = _slave.hosts.filterProperty('isInstalled', false).mapProperty('hostName');
  1071. this.registerHostsToComponent(hostNames, _slave.componentName);
  1072. }
  1073. }
  1074. else {
  1075. clients.forEach(function (_client) {
  1076. var hostNames = _slave.hosts.mapProperty('hostName');
  1077. // The below logic to install clients to existing/New master hosts should not be applied to Add Host wizard.
  1078. // This is with the presumption that Add Host controller does not add any new Master component to the cluster
  1079. if (this.get('content.controllerName') !== 'addHostController') {
  1080. if (clientsToMasterMap[_client.component_name]) {
  1081. clientsToMasterMap[_client.component_name].forEach(function (componentName) {
  1082. masterHosts.filterProperty('component', componentName).forEach(function (_masterHost) {
  1083. hostNames.pushObject(_masterHost.hostName);
  1084. });
  1085. });
  1086. }
  1087. }
  1088. if (clientOnAllHosts.length > 0) {
  1089. var compOnAllHosts = false;
  1090. for (var i=0; i < clientOnAllHosts.length; i++) {
  1091. if (_client.component_name == clientOnAllHosts[i]) {
  1092. // component with ALL cardinality should not
  1093. // registerHostsToComponent in createSlaveAndClientsHostComponents
  1094. compOnAllHosts = true;
  1095. break;
  1096. }
  1097. }
  1098. if (!compOnAllHosts) {
  1099. hostNames = hostNames.uniq();
  1100. this.registerHostsToComponent(hostNames, _client.component_name);
  1101. }
  1102. } else {
  1103. hostNames = hostNames.uniq();
  1104. this.registerHostsToComponent(hostNames, _client.component_name);
  1105. }
  1106. }, this);
  1107. }
  1108. }, this);
  1109. },
  1110. /**
  1111. * This function is specific to addServiceController
  1112. * Newly introduced master components requires some existing client components to be hosted along with them
  1113. */
  1114. createAdditionalClientComponents: function () {
  1115. var masterHosts = this.get('content.masterComponentHosts');
  1116. var clientHosts = [];
  1117. if (this.get('content.slaveComponentHosts').someProperty('componentName', 'CLIENT')) {
  1118. clientHosts = this.get('content.slaveComponentHosts').findProperty('componentName', 'CLIENT').hosts;
  1119. }
  1120. var clients = this.get('content.clients').filterProperty('isInstalled', false);
  1121. var clientsToMasterMap = this.getClientsMap('isMaster');
  1122. var clientsToClientMap = this.getClientsMap('isClient');
  1123. var installedClients = [];
  1124. // Get all the installed Client components
  1125. this.get('content.services').filterProperty('isInstalled').forEach(function (_service) {
  1126. var serviceClients = App.StackServiceComponent.find().filterProperty('serviceName', _service.get('serviceName')).filterProperty('isClient');
  1127. serviceClients.forEach(function (client) {
  1128. installedClients.push(client.get('componentName'));
  1129. }, this);
  1130. }, this);
  1131. // Check if there is a dependency for being co-hosted between existing client and selected new master
  1132. installedClients.forEach(function (_clientName) {
  1133. if (clientsToMasterMap[_clientName] || clientsToClientMap[_clientName]) {
  1134. var hostNames = [];
  1135. if (clientsToMasterMap[_clientName]) {
  1136. clientsToMasterMap[_clientName].forEach(function (componentName) {
  1137. masterHosts.filterProperty('component', componentName).filterProperty('isInstalled', false).forEach(function (_masterHost) {
  1138. hostNames.pushObject(_masterHost.hostName);
  1139. }, this);
  1140. }, this);
  1141. }
  1142. if (clientsToClientMap[_clientName]) {
  1143. clientsToClientMap[_clientName].forEach(function (componentName) {
  1144. clientHosts.forEach(function (_clientHost) {
  1145. var host = this.get('content.hosts')[_clientHost.hostName];
  1146. if (host.isInstalled && !host.hostComponents.someProperty('HostRoles.component_name', componentName)) {
  1147. hostNames.pushObject(_clientHost.hostName);
  1148. }
  1149. }, this);
  1150. }, this);
  1151. }
  1152. hostNames = hostNames.uniq();
  1153. if (hostNames.length > 0) {
  1154. // If a dependency for being co-hosted is derived between existing client and selected new master but that
  1155. // dependency is already satisfied in the cluster then disregard the derived dependency
  1156. this.removeClientsFromList(_clientName, hostNames);
  1157. this.registerHostsToComponent(hostNames, _clientName);
  1158. if(hostNames.length > 0) {
  1159. this.get('content.additionalClients').pushObject({hostNames: hostNames, componentName: _clientName});
  1160. }
  1161. }
  1162. }
  1163. }, this);
  1164. },
  1165. /**
  1166. *
  1167. * @param clientName
  1168. * @param hostList
  1169. */
  1170. removeClientsFromList: function (clientName, hostList) {
  1171. var clientHosts = [];
  1172. var installedHosts = this.get('content.hosts');
  1173. for (var hostName in installedHosts) {
  1174. if (installedHosts[hostName].isInstalled) {
  1175. if (installedHosts[hostName].hostComponents.mapProperty('HostRoles.component_name').contains(clientName)) {
  1176. clientHosts.push(hostName);
  1177. }
  1178. }
  1179. }
  1180. if (clientHosts.length > 0) {
  1181. clientHosts.forEach(function (hostName) {
  1182. if (hostList.contains(hostName)) {
  1183. hostList.splice(hostList.indexOf(hostName), 1);
  1184. }
  1185. }, this);
  1186. }
  1187. },
  1188. /**
  1189. * Register additional components
  1190. * Based on availability of some services
  1191. * @uses registerHostsToComponent
  1192. * @method createAdditionalHostComponents
  1193. */
  1194. createAdditionalHostComponents: function () {
  1195. var masterHosts = this.get('content.masterComponentHosts');
  1196. // add all components with cardinality == ALL of selected services
  1197. var registeredHosts = this.getRegisteredHosts();
  1198. var notInstalledHosts = registeredHosts.filterProperty('isInstalled', false);
  1199. this.get('content.services').filterProperty('isSelected').forEach(function (service) {
  1200. service.get('serviceComponents').filterProperty('isRequiredOnAllHosts').forEach(function (component) {
  1201. if (service.get('isInstalled') && notInstalledHosts.length) {
  1202. this.registerHostsToComponent(notInstalledHosts.mapProperty('hostName'), component.get('componentName'));
  1203. } else if (!service.get('isInstalled') && registeredHosts.length) {
  1204. this.registerHostsToComponent(registeredHosts.mapProperty('hostName'), component.get('componentName'));
  1205. }
  1206. }, this);
  1207. }, this);
  1208. // add MySQL Server if Hive is selected
  1209. var hiveService = this.get('content.services').filterProperty('isSelected', true).filterProperty('isInstalled', false).findProperty('serviceName', 'HIVE');
  1210. if (hiveService) {
  1211. var hiveDb = this.get('content.serviceConfigProperties').findProperty('name', 'hive_database');
  1212. if (hiveDb.value == "New MySQL Database") {
  1213. this.registerHostsToComponent(masterHosts.filterProperty('component', 'HIVE_SERVER').mapProperty('hostName'), 'MYSQL_SERVER');
  1214. } else if (hiveDb.value === "New PostgreSQL Database") {
  1215. this.registerHostsToComponent(masterHosts.filterProperty('component', 'HIVE_SERVER').mapProperty('hostName'), 'POSTGRESQL_SERVER');
  1216. }
  1217. }
  1218. },
  1219. /**
  1220. * Register component to hosts
  1221. * Queued request
  1222. * @param {String[]} hostNames
  1223. * @param {String} componentName
  1224. * @method registerHostsToComponent
  1225. */
  1226. registerHostsToComponent: function (hostNames, componentName) {
  1227. if (!hostNames.length) return;
  1228. var queryStr = '';
  1229. hostNames.forEach(function (hostName) {
  1230. queryStr += 'Hosts/host_name=' + hostName + '|';
  1231. });
  1232. //slice off last symbol '|'
  1233. queryStr = queryStr.slice(0, -1);
  1234. var data = {
  1235. "RequestInfo": {
  1236. "query": queryStr
  1237. },
  1238. "Body": {
  1239. "host_components": [
  1240. {
  1241. "HostRoles": {
  1242. "component_name": componentName
  1243. }
  1244. }
  1245. ]
  1246. }
  1247. };
  1248. this.addRequestToAjaxQueue({
  1249. name: 'wizard.step8.register_host_to_component',
  1250. data: {
  1251. data: JSON.stringify(data)
  1252. }
  1253. });
  1254. },
  1255. /**
  1256. * Compare generated config object with current configs that were filled
  1257. * on "Customize Services" page.
  1258. *
  1259. * @param {Object} properties - generated by createSiteObj|createCoreSiteObj
  1260. * @param {Array} configs - current configs to compare
  1261. * @return {Boolean}
  1262. * @method isConfigsChanged
  1263. **/
  1264. isConfigsChanged: function (properties, configs) {
  1265. var isChanged = false;
  1266. for (var property in properties) {
  1267. var config = configs.findProperty('name', property);
  1268. // if config not found then it's looks like a new config
  1269. if (!config) {
  1270. isChanged = true;
  1271. } else {
  1272. if (!config.hasInitialValue || config.isNotDefaultValue) {
  1273. isChanged = true;
  1274. }
  1275. }
  1276. }
  1277. return isChanged;
  1278. },
  1279. /**
  1280. * Create config objects for cluster and services
  1281. * @method createConfigurations
  1282. */
  1283. createConfigurations: function () {
  1284. var selectedServices = this.get('selectedServices');
  1285. var coreSiteObject = this.createCoreSiteObj();
  1286. var tag = 'version1';
  1287. var clusterSiteObj = this.createSiteObj('cluster-env', tag);
  1288. if (this.get('content.controllerName') == 'installerController') {
  1289. this.get('serviceConfigTags').pushObject(clusterSiteObj);
  1290. }
  1291. if (this.get('content.controllerName') == 'addServiceController') {
  1292. tag = 'version' + (new Date).getTime();
  1293. coreSiteObject.tag = tag;
  1294. var coreSiteConfigs = this.get('configs').filterProperty('filename', 'core-site.xml');
  1295. if (this.isConfigsChanged(coreSiteObject.properties, coreSiteConfigs)) {
  1296. coreSiteObject.service_config_version_note = Em.I18n.t('dashboard.configHistory.table.notes.addService');
  1297. this.get('serviceConfigTags').pushObject(coreSiteObject);
  1298. }
  1299. }
  1300. selectedServices.forEach(function (service) {
  1301. Object.keys(service.get('configTypes')).forEach(function (type) {
  1302. if (!this.get('serviceConfigTags').someProperty('type', type)) {
  1303. var serviceVersionNotes = Em.I18n.t('dashboard.configHistory.table.notes.default').format(service.get('displayName'));
  1304. if (type === 'core-site') {
  1305. coreSiteObject.service_config_version_note = serviceVersionNotes;
  1306. this.get('serviceConfigTags').pushObject(coreSiteObject);
  1307. } else if (type === 'storm-site') {
  1308. var obj = this.createStormSiteObj(tag);
  1309. obj.service_config_version_note = serviceVersionNotes;
  1310. this.get('serviceConfigTags').pushObject(obj);
  1311. } else {
  1312. var obj = this.createSiteObj(type, tag);
  1313. obj.service_config_version_note = serviceVersionNotes;
  1314. this.get('serviceConfigTags').pushObject(obj);
  1315. }
  1316. }
  1317. }, this);
  1318. }, this);
  1319. this.createNotification();
  1320. },
  1321. /**
  1322. * Send <code>serviceConfigTags</code> to server
  1323. * Queued request
  1324. * One request for each service config tag
  1325. * @param serviceConfigTags
  1326. * @method applyConfigurationsToCluster
  1327. */
  1328. applyConfigurationsToCluster: function (serviceConfigTags) {
  1329. var allServices = this.get('installedServices').concat(this.get('selectedServices'));
  1330. var allConfigData = [];
  1331. allServices.forEach(function (service) {
  1332. var serviceConfigData = [];
  1333. Object.keys(service.get('configTypesRendered')).forEach(function (type) {
  1334. var serviceConfigTag = serviceConfigTags.findProperty('type', type);
  1335. if (serviceConfigTag) {
  1336. serviceConfigData.pushObject(serviceConfigTag);
  1337. }
  1338. }, this);
  1339. if (serviceConfigData.length) {
  1340. allConfigData.pushObject(JSON.stringify({
  1341. Clusters: {
  1342. desired_config: serviceConfigData.map(function(item) {
  1343. var props = {};
  1344. Em.keys(item.properties).forEach(function(propName) {
  1345. if (item.properties[propName] !== null) {
  1346. props[propName] = item.properties[propName];
  1347. }
  1348. });
  1349. item.properties = props;
  1350. return item;
  1351. })
  1352. }
  1353. }));
  1354. }
  1355. }, this);
  1356. var clusterConfig = serviceConfigTags.findProperty('type', 'cluster-env');
  1357. if (clusterConfig) {
  1358. allConfigData.pushObject(JSON.stringify({
  1359. Clusters: {
  1360. desired_config: [clusterConfig]
  1361. }
  1362. }));
  1363. }
  1364. this.addRequestToAjaxQueue({
  1365. name: 'common.across.services.configurations',
  1366. data: {
  1367. data: '[' + allConfigData.toString() + ']'
  1368. }
  1369. });
  1370. },
  1371. /**
  1372. * Create and update config groups
  1373. * @method createConfigurationGroups
  1374. */
  1375. createConfigurationGroups: function () {
  1376. var configGroups = this.get('content.configGroups').filterProperty('is_default', false);
  1377. var clusterName = this.get('clusterName');
  1378. var sendData = [];
  1379. var updateData = [];
  1380. var timeTag = (new Date).getTime();
  1381. var groupsToDelete = App.router.get(this.get('content.controllerName')).getDBProperty('groupsToDelete');
  1382. if (groupsToDelete && groupsToDelete.length > 0) {
  1383. this.removeInstalledServicesConfigurationGroups(groupsToDelete);
  1384. }
  1385. configGroups.forEach(function (configGroup) {
  1386. var groupConfigs = [];
  1387. var groupData = {
  1388. "cluster_name": clusterName,
  1389. "group_name": configGroup.name,
  1390. "tag": configGroup.service_id,
  1391. "description": configGroup.description,
  1392. "hosts": [],
  1393. "desired_configs": []
  1394. };
  1395. configGroup.hosts.forEach(function (hostName) {
  1396. groupData.hosts.push({"host_name": hostName});
  1397. });
  1398. // get properties that was created for non-default config group
  1399. configGroup.properties = configGroup.properties.concat(this.get('customNonDefaultGroupConfigs').filterProperty('group', configGroup.name));
  1400. //wrap properties into Em.Object to make them compatible with buildGroupDesiredConfigs method
  1401. configGroup.properties.forEach(function (property) {
  1402. groupConfigs.push(Em.Object.create(property));
  1403. });
  1404. groupData.desired_configs = this.buildGroupDesiredConfigs(groupConfigs, timeTag);
  1405. // check for group from installed service
  1406. if (configGroup.is_for_installed_service === true) {
  1407. // if group is a new one, create it
  1408. if (!configGroup.id) {
  1409. sendData.push({"ConfigGroup": groupData});
  1410. } else if (configGroup.is_for_update){
  1411. // update an existing group
  1412. groupData.id = configGroup.id;
  1413. updateData.push({"ConfigGroup": groupData});
  1414. }
  1415. } else {
  1416. sendData.push({"ConfigGroup": groupData});
  1417. }
  1418. //each group should have unique tag to prevent overriding configs from common sites
  1419. timeTag++;
  1420. }, this);
  1421. if (sendData.length > 0) {
  1422. this.applyConfigurationGroups(sendData);
  1423. }
  1424. if (updateData.length > 0) {
  1425. this.applyInstalledServicesConfigurationGroup(updateData);
  1426. }
  1427. },
  1428. /**
  1429. * construct desired_configs for config groups from overriden properties
  1430. * @param configs
  1431. * @param timeTag
  1432. * @return {Array}
  1433. * @private
  1434. * @method buildGroupDesiredConfigs
  1435. */
  1436. buildGroupDesiredConfigs: function (configs, timeTag) {
  1437. var sites = [];
  1438. var time = timeTag || (new Date).getTime();
  1439. var siteFileNames = configs.mapProperty('filename').uniq();
  1440. sites = siteFileNames.map(function (filename) {
  1441. return {
  1442. type: filename.replace('.xml', ''),
  1443. tag: 'version' + time,
  1444. properties: []
  1445. };
  1446. });
  1447. configs.forEach(function (config) {
  1448. var type = config.get('filename').replace('.xml', '');
  1449. var site = sites.findProperty('type', type);
  1450. site.properties.push(config);
  1451. });
  1452. return sites.map(function (site) {
  1453. return App.router.get('mainServiceInfoConfigsController').createSiteObj(site.type, site.tag, site.properties);
  1454. }, this);
  1455. },
  1456. /**
  1457. * Create new config groups request
  1458. * Queued request
  1459. * @param {Object[]} sendData
  1460. * @method applyConfigurationGroups
  1461. */
  1462. applyConfigurationGroups: function (sendData) {
  1463. this.addRequestToAjaxQueue({
  1464. name: 'wizard.step8.apply_configuration_groups',
  1465. data: {
  1466. data: JSON.stringify(sendData)
  1467. }
  1468. });
  1469. },
  1470. /**
  1471. * Update existed config groups
  1472. * Separated request for each group
  1473. * @param {Object[]} updateData
  1474. * @method applyInstalledServicesConfigurationGroup
  1475. */
  1476. applyInstalledServicesConfigurationGroup: function (updateData) {
  1477. updateData.forEach(function (item) {
  1478. App.router.get('mainServiceInfoConfigsController').putConfigGroupChanges(item);
  1479. });
  1480. },
  1481. /**
  1482. * Delete selected config groups
  1483. * @param {Object[]} groupsToDelete
  1484. * @method removeInstalledServicesConfigurationGroups
  1485. */
  1486. removeInstalledServicesConfigurationGroups: function (groupsToDelete) {
  1487. var self = this;
  1488. groupsToDelete.forEach(function (item) {
  1489. self.deleteConfigurationGroup(Em.Object.create(item));
  1490. });
  1491. },
  1492. /**
  1493. * Create Core Site object
  1494. * @returns {{type: string, tag: string, properties: {}}}
  1495. * @method createCoreSiteObj
  1496. */
  1497. createCoreSiteObj: function () {
  1498. var installedAndSelectedServices = Em.A([]);
  1499. installedAndSelectedServices.pushObjects(this.get('installedServices'));
  1500. installedAndSelectedServices.pushObjects(this.get('selectedServices'));
  1501. var coreSiteObj = this.get('configs').filterProperty('filename', 'core-site.xml'),
  1502. coreSiteProperties = this.createSiteObj('core-site', 'version1').properties,
  1503. isGLUSTERFSSelected = installedAndSelectedServices.someProperty('serviceName', 'GLUSTERFS');
  1504. coreSiteObj.forEach(function (_coreSiteObj) {
  1505. if (coreSiteObj.isRequiredByAgent !== false) {
  1506. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.default.name") {
  1507. coreSiteProperties[_coreSiteObj.name] =
  1508. this.get('configs').someProperty('name', 'fs_glusterfs_default_name') ?
  1509. this.get('configs').findProperty('name', 'fs_glusterfs_default_name').value : null;
  1510. }
  1511. if (isGLUSTERFSSelected && _coreSiteObj.name == "fs.defaultFS") {
  1512. coreSiteProperties[_coreSiteObj.name] =
  1513. this.get('configs').someProperty('name', 'glusterfs_defaultFS_name') ?
  1514. this.get('configs').findProperty('name', 'glusterfs_defaultFS_name').value : null;
  1515. }
  1516. }
  1517. }, this);
  1518. var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(coreSiteObj);
  1519. var configObj = {"type": "core-site", "tag": "version1", "properties": coreSiteProperties};
  1520. if (attributes) {
  1521. configObj['properties_attributes'] = attributes;
  1522. }
  1523. return configObj;
  1524. },
  1525. /**
  1526. * Create siteObj for custom service with it own configs
  1527. * @param {string} site
  1528. * @param tag
  1529. * @returns {{type: string, tag: string, properties: {}}}
  1530. * @method createSiteObj
  1531. */
  1532. createSiteObj: function (site, tag) {
  1533. var properties = {};
  1534. var configs = this.get('configs').filterProperty('filename', site + '.xml');
  1535. var attributes = App.router.get('mainServiceInfoConfigsController').getConfigAttributes(configs);
  1536. configs.forEach(function (_configProperty) {
  1537. var heapsizeExceptions = ['hadoop_heapsize', 'yarn_heapsize', 'nodemanager_heapsize', 'resourcemanager_heapsize', 'apptimelineserver_heapsize',
  1538. 'jobhistory_heapsize', 'nfsgateway_heapsize', 'accumulo_master_heapsize', 'accumulo_tserver_heapsize', 'accumulo_monitor_heapsize', 'accumulo_gc_heapsize',
  1539. 'accumulo_other_heapsize', 'hbase_master_heapsize', 'hbase_regionserver_heapsize', 'metrics_collector_heapsize'];
  1540. // do not pass any globals whose name ends with _host or _hosts
  1541. if (_configProperty.isRequiredByAgent !== false) {
  1542. // append "m" to JVM memory options except for heapsizeExtensions
  1543. if (/_heapsize|_newsize|_maxnewsize|_permsize|_maxpermsize$/.test(_configProperty.name) && !heapsizeExceptions.contains(_configProperty.name) && !(_configProperty.value).endsWith("m")) {
  1544. properties[_configProperty.name] = _configProperty.value + "m";
  1545. } else {
  1546. properties[_configProperty.name] = _configProperty.value;
  1547. }
  1548. }
  1549. }, this);
  1550. var configObj = {"type": site, "tag": tag, "properties": properties };
  1551. if (attributes) {
  1552. configObj['properties_attributes'] = attributes;
  1553. }
  1554. return configObj;
  1555. },
  1556. /**
  1557. * Create site obj for Storm
  1558. * Some config-properties should be modified in custom way
  1559. * @param tag
  1560. * @returns {{type: string, tag: string, properties: {}}}
  1561. * @method createStormSiteObj
  1562. */
  1563. createStormSiteObj: function (tag) {
  1564. var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
  1565. var stormProperties = {};
  1566. configs.forEach(function (_configProperty) {
  1567. if (_configProperty.isRequiredByAgent !== false) {
  1568. if (["nimbus.seeds", "storm.zookeeper.servers"].contains(_configProperty.name)) {
  1569. stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g, "'");
  1570. } else {
  1571. stormProperties[_configProperty.name] = _configProperty.value;
  1572. }
  1573. }
  1574. }, this);
  1575. return {type: 'storm-site', tag: tag, properties: stormProperties};
  1576. },
  1577. /**
  1578. * Create one Alert Notification (if user select this on step7)
  1579. * Only for Install Wizard and stack
  1580. * @method createNotification
  1581. */
  1582. createNotification: function () {
  1583. if (this.get('content.controllerName') !== 'installerController') return;
  1584. var miscConfigs = this.get('configs').filterProperty('serviceName', 'MISC'),
  1585. createNotification = miscConfigs.findProperty('name', 'create_notification').value;
  1586. if (createNotification !== 'yes') return;
  1587. var predefinedNotificationConfigNames = require('data/HDP2/alert_notification').mapProperty('name'),
  1588. configsForNotification = this.get('configs').filterProperty('filename', 'alert_notification');
  1589. var properties = {},
  1590. names = [
  1591. 'ambari.dispatch.recipients',
  1592. 'mail.smtp.host',
  1593. 'mail.smtp.port',
  1594. 'mail.smtp.from',
  1595. 'mail.smtp.starttls.enable',
  1596. 'mail.smtp.startssl.enable'
  1597. ];
  1598. if (miscConfigs.findProperty('name', 'smtp_use_auth').value == 'true') { // yes, it's not converted to boolean
  1599. names.pushObjects(['ambari.dispatch.credential.username', 'ambari.dispatch.credential.password']);
  1600. }
  1601. names.forEach(function (name) {
  1602. properties[name] = miscConfigs.findProperty('name', name).value;
  1603. });
  1604. properties['ambari.dispatch.recipients'] = properties['ambari.dispatch.recipients'].replace(/\s/g, '').split(',');
  1605. configsForNotification.forEach(function (config) {
  1606. if (predefinedNotificationConfigNames.contains(config.name)) return;
  1607. properties[config.name] = config.value;
  1608. });
  1609. var apiObject = {
  1610. AlertTarget: {
  1611. name: 'Initial Notification',
  1612. description: 'Notification created during cluster installing',
  1613. global: true,
  1614. notification_type: 'EMAIL',
  1615. alert_states: ['OK', 'WARNING', 'CRITICAL', 'UNKNOWN'],
  1616. properties: properties
  1617. }
  1618. };
  1619. this.addRequestToAjaxQueue({
  1620. name: 'alerts.create_alert_notification',
  1621. data: {
  1622. urlParams: 'overwrite_existing=true',
  1623. data: apiObject
  1624. }
  1625. });
  1626. },
  1627. /**
  1628. * Should ajax-queue progress bar be displayed
  1629. * @method showLoadingIndicator
  1630. */
  1631. showLoadingIndicator: function () {
  1632. return App.ModalPopup.show({
  1633. header: '',
  1634. showFooter: false,
  1635. showCloseButton: false,
  1636. bodyClass: Em.View.extend({
  1637. templateName: require('templates/wizard/step8/step8_log_popup'),
  1638. controllerBinding: 'App.router.wizardStep8Controller',
  1639. /**
  1640. * Css-property for progress-bar
  1641. * @type {string}
  1642. */
  1643. barWidth: '',
  1644. progressBarClass: 'progress log_popup',
  1645. /**
  1646. * Popup-message
  1647. * @type {string}
  1648. */
  1649. message: '',
  1650. /**
  1651. * Set progress bar width and popup message when ajax-queue requests are proccessed
  1652. * @method ajaxQueueChangeObs
  1653. */
  1654. ajaxQueueChangeObs: function () {
  1655. var length = this.get('controller.ajaxQueueLength');
  1656. var left = this.get('controller.ajaxRequestsQueue.queue.length');
  1657. this.set('barWidth', 'width: ' + ((length - left) / length * 100) + '%;');
  1658. this.set('message', Em.I18n.t('installer.step8.deployPopup.message').format((length - left), length));
  1659. }.observes('controller.ajaxQueueLength', 'controller.ajaxRequestsQueue.queue.length'),
  1660. /**
  1661. * Hide popup when ajax-queue is finished
  1662. * @method autoHide
  1663. */
  1664. autoHide: function () {
  1665. if (this.get('controller.servicesInstalled')) {
  1666. this.get('parentView').hide();
  1667. }
  1668. }.observes('controller.servicesInstalled')
  1669. })
  1670. });
  1671. }
  1672. });