Sfoglia il codice sorgente

AMBARI-9832 JournalNode kerberos configs are missing when trying to enable HA. (ababiichuk)

aBabiichuk 10 anni fa
parent
commit
74b4287f9d

+ 3 - 3
ambari-web/app/controllers/main/admin/highAvailability/nameNode/step3_controller.js

@@ -83,7 +83,7 @@ App.HighAvailabilityWizardStep3Controller = Em.Controller.extend({
 
 
   onLoadConfigs: function (data) {
   onLoadConfigs: function (data) {
     this.set('serverConfigData',data);
     this.set('serverConfigData',data);
-    this.removeConfigs(this.get('configsToRemove'));
+    this.removeConfigs(this.get('configsToRemove'), this.get('serverConfigData'));
     this.tweakServiceConfigs(this.get('haConfig.configs'));
     this.tweakServiceConfigs(this.get('haConfig.configs'));
     this.renderServiceConfigs(this.get('haConfig'));
     this.renderServiceConfigs(this.get('haConfig'));
     this.set('isLoaded', true);
     this.set('isLoaded', true);
@@ -146,10 +146,10 @@ App.HighAvailabilityWizardStep3Controller = Em.Controller.extend({
   /**
   /**
    * Find and remove config properties in <code>serverConfigData</code>
    * Find and remove config properties in <code>serverConfigData</code>
    * @param configsToRemove - map of config sites and properties to remove
    * @param configsToRemove - map of config sites and properties to remove
+   * @param configs - configuration object
    * @returns {Object}
    * @returns {Object}
    */
    */
-  removeConfigs:function (configsToRemove) {
-    var configs = this.get('serverConfigData');
+  removeConfigs:function (configsToRemove, configs) {
     Em.keys(configsToRemove).forEach(function(site){
     Em.keys(configsToRemove).forEach(function(site){
       var siteConfigs = configs.items.findProperty('type', site);
       var siteConfigs = configs.items.findProperty('type', site);
       if (siteConfigs) {
       if (siteConfigs) {

+ 43 - 1
ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js

@@ -85,6 +85,18 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont
 
 
   reconfigureHDFS: function () {
   reconfigureHDFS: function () {
     var data = this.get('content.serviceConfigProperties');
     var data = this.get('content.serviceConfigProperties');
+    if (App.router.get('mainAdminKerberosController.securityEnabled')) {
+      this.reconfigureSecureHDFS();
+    } else {
+      this.updateConfigProperties(data);
+    }
+  },
+
+  /**
+   * Update service configurations
+   * @param {Object} data - config object to update
+   */
+  updateConfigProperties: function(data) {
     var siteNames = ['hdfs-site','core-site'];
     var siteNames = ['hdfs-site','core-site'];
     var configData = this.reconfigureSites(siteNames, data);
     var configData = this.reconfigureSites(siteNames, data);
     App.ajax.send({
     App.ajax.send({
@@ -95,7 +107,7 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont
       },
       },
       error: 'onTaskError',
       error: 'onTaskError',
       success: 'installHDFSClients'
       success: 'installHDFSClients'
-    })
+    });
   },
   },
 
 
   installHDFSClients: function () {
   installHDFSClients: function () {
@@ -110,6 +122,36 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont
       wizardControllerName: this.get('content.controllerName'),
       wizardControllerName: this.get('content.controllerName'),
       localdb: App.db.data
       localdb: App.db.data
     });
     });
+  },
+
+  /**
+   * Process configurations for hdfs on kerberized cluster.
+   * Secure properties will be applied to hdfs and core site after installing JournalNode.
+   * For this case we need to pull updated configurations from API, merge them with configurations created
+   * during `Review` step and store new configurations.
+   */
+  reconfigureSecureHDFS: function() {
+    App.router.get('highAvailabilityWizardStep3Controller').loadConfigsTags.call(this);
+  },
+
+  onLoadConfigsTags: function() {
+    App.router.get('highAvailabilityWizardStep3Controller').onLoadConfigsTags.apply(this, [].slice.call(arguments));
+  },
+
+  onLoadConfigs: function(data) {
+    var self = this;
+    var configController = App.router.get('highAvailabilityWizardStep3Controller');
+    var configData = $.extend({}, data);
+    var configItems = data.items.map(function(item) {
+      var fileName = Em.get(item, 'type');
+      var configTypeObject = self.get('content.serviceConfigProperties').items.findProperty('type', fileName);
+      if (configTypeObject) {
+        $.extend(item.properties, configTypeObject.properties);
+      }
+      return item;
+    });
+    configItems = configController.removeConfigs(configController.get('configsToRemove'), {items: configItems});
+    this.updateConfigProperties(configItems);
   }
   }
 });
 });
 
 

+ 2 - 1
ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js

@@ -138,8 +138,9 @@ describe('App.HighAvailabilityWizardStep3Controller', function() {
           configsToRemove: test.toRemove,
           configsToRemove: test.toRemove,
           serverConfigData: test.configs
           serverConfigData: test.configs
         });
         });
-        controller.removeConfigs(test.toRemove);
+        var result = controller.removeConfigs(test.toRemove, controller.get('serverConfigData'));
         expect(JSON.stringify(controller.get('serverConfigData'))).to.equal(JSON.stringify(test.expected));
         expect(JSON.stringify(controller.get('serverConfigData'))).to.equal(JSON.stringify(test.expected));
+        expect(JSON.stringify(result)).to.equal(JSON.stringify(test.expected));
       });
       });
     });
     });
   });
   });