step4_controller.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.RAHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageController.extend({
  20. name: "rAHighAvailabilityWizardStep4Controller",
  21. clusterDeployState: 'RA_HIGH_AVAILABILITY_DEPLOY',
  22. commands: ['stopRequiredServices', 'installRangerAdmin', 'reconfigureRanger', 'startAllServices'],
  23. tasksMessagesPrefix: 'admin.ra_highAvailability.wizard.step',
  24. stopRequiredServices: function () {
  25. this.stopServices(['HDFS']);
  26. },
  27. installRangerAdmin: function () {
  28. var hostNames = this.get('content.raHosts.additionalRA');
  29. this.createComponent('RANGER_ADMIN', hostNames, "RANGER");
  30. },
  31. reconfigureRanger: function () {
  32. this.loadConfigsTags();
  33. },
  34. loadConfigsTags: function () {
  35. App.ajax.send({
  36. name: 'config.tags',
  37. sender: this,
  38. success: 'onLoadConfigsTags',
  39. error: 'onTaskError'
  40. });
  41. },
  42. onLoadConfigsTags: function (data) {
  43. App.ajax.send({
  44. name: 'reassign.load_configs',
  45. sender: this,
  46. data: {
  47. urlParams: '(type=admin-properties&tag=' + data.Clusters.desired_configs['admin-properties'].tag + ')'
  48. },
  49. success: 'onLoadConfigs',
  50. error: 'onTaskError'
  51. });
  52. },
  53. onLoadConfigs: function (data) {
  54. data.items.findProperty('type', 'admin-properties').properties['policymgr_external_url'] = this.get('content.loadBalancerURL');
  55. var configData = this.reconfigureSites(['admin-properties'], data, Em.I18n.t('admin.highAvailability.step4.save.configuration.note').format(App.format.role('RANGER_ADMIN')));
  56. App.ajax.send({
  57. name: 'common.service.configurations',
  58. sender: this,
  59. data: {
  60. desired_config: configData
  61. },
  62. success: 'onSaveConfigs',
  63. error: 'onTaskError'
  64. });
  65. },
  66. onSaveConfigs: function () {
  67. this.onTaskCompleted();
  68. },
  69. startAllServices: function () {
  70. this.startServices(true);
  71. }
  72. });