step5_view.js 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.ReassignMasterWizardStep5View = Em.View.extend({
  20. templateName: require('templates/main/service/reassign/step5'),
  21. manualCommands: function () {
  22. if (!this.get('controller.content.componentsWithManualCommands').contains(this.get('controller.content.reassign.component_name'))) {
  23. return '';
  24. }
  25. var
  26. atsDir = App.get('isHadoop23Stack') ? "timeline-state-store.ldb" : "leveldb-timeline-store.ldb",
  27. componentDir = this.get('controller.content.componentDir') || '',
  28. componentDirCmd = componentDir.replace(/,/g, ' '),
  29. sourceHost = this.get('controller.content.reassignHosts.source'),
  30. targetHost = this.get('controller.content.reassignHosts.target'),
  31. ha = '',
  32. user = this.get('controller.content.hdfsUser'), path;
  33. if (this.get('controller.content.reassign.component_name') === 'NAMENODE' && App.get('isHaEnabled')) {
  34. ha = '_ha';
  35. var nnStartedHost = this.get('controller.content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName').without(sourceHost).without(targetHost);
  36. }
  37. if (this.get('controller.content.reassign.component_name') === 'APP_TIMELINE_SERVER') {
  38. user = this.get('controller.content.serviceProperties.yarn-env.yarn_user');
  39. path = this.get('controller.content.serviceProperties.yarn-site')['yarn.timeline-service.leveldb-timeline-store.path'];
  40. }
  41. return Em.I18n.t('services.reassign.step5.body.' + this.get('controller.content.reassign.component_name').toLowerCase() + ha).
  42. format(componentDir, sourceHost, targetHost, user, nnStartedHost,this.get('controller.content.group'), componentDirCmd, path, atsDir);
  43. }.property('controller.content.reassign.component_name', 'controller.content.componentDir', 'controller.content.masterComponentHosts', 'controller.content.reassign.host_id', 'controller.content.hdfsUser'),
  44. /**
  45. * security notice to generate keytab manually is not used any more
  46. */
  47. securityNotice: function () {
  48. var secureConfigs = this.get('controller.content.secureConfigs');
  49. var proceedMsg = Em.I18n.t('services.reassign.step5.body.proceedMsg');
  50. var hasSecureConfigs = !this.get('controller.content.componentsWithoutSecurityConfigs').contains(this.get('controller.content.reassign.component_name'));
  51. if(!hasSecureConfigs) {
  52. secureConfigs = [];
  53. }
  54. if (!App.get('isKerberosEnabled') || !secureConfigs.length) {
  55. return proceedMsg;
  56. }
  57. var formattedText = '<ul>';
  58. secureConfigs.forEach(function (config) {
  59. formattedText += '<li>' + Em.I18n.t('services.reassign.step5.body.securityConfigsList').format(config.keytab,
  60. config.principal.replace('_HOST', this.get('controller.content.reassignHosts.target')), this.get('controller.content.reassignHosts.target')) + '</li>';
  61. }, this);
  62. formattedText += '</ul>';
  63. return Em.I18n.t('services.reassign.step5.body.securityNotice').format(formattedText) + proceedMsg;
  64. }.property('App.isKerberosEnabled','controller.content.secureConfigs', 'controller.content.reassignHosts.target')
  65. });