step3_controller.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. App.KerberosWizardStep3Controller = App.KerberosProgressPageController.extend({
  19. name: 'kerberosWizardStep3Controller',
  20. clusterDeployState: 'KERBEROS_DEPLOY',
  21. serviceName: 'KERBEROS',
  22. componentName: 'KERBEROS_CLIENT',
  23. commands: ['installKerberos', 'testKerberos'],
  24. installKerberos: function() {
  25. var self = this;
  26. this.getKerberosClientState().done(function(data) {
  27. if (data.ServiceComponentInfo.state === 'INIT') {
  28. App.ajax.send({
  29. name: 'common.services.update',
  30. sender: self,
  31. data: {
  32. context: Em.I18n.t('requestInfo.kerberosService'),
  33. ServiceInfo: {"state": "INSTALLED"},
  34. urlParams: "ServiceInfo/state=INSTALLED&ServiceInfo/service_name=KERBEROS"
  35. },
  36. success: 'startPolling',
  37. error: 'onTaskError'
  38. });
  39. } else {
  40. var hostNames = self.get('content.hosts');
  41. self.updateComponent('KERBEROS_CLIENT', hostNames, "KERBEROS", "Install");
  42. }
  43. });
  44. },
  45. getKerberosClientState: function() {
  46. return App.ajax.send({
  47. name: 'common.service_component.info',
  48. sender: this,
  49. data: {
  50. serviceName: this.serviceName,
  51. componentName: this.componentName,
  52. urlParams: "fields=ServiceComponentInfo/state"
  53. }
  54. });
  55. },
  56. testKerberos: function() {
  57. App.ajax.send({
  58. 'name': 'service.item.smoke',
  59. 'sender': this,
  60. 'success': 'startPolling',
  61. 'error': 'onTaskError',
  62. 'data': {
  63. 'serviceName': this.serviceName,
  64. 'displayName': App.format.role(this.serviceName),
  65. 'actionName': this.serviceName + '_SERVICE_CHECK'
  66. }
  67. });
  68. }
  69. });