You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2016/03/11 13:51:42 UTC

ambari git commit: AMBARI-15369. Ambari cannot enable NN HA in kerberos env (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 13b5f2d20 -> fe2462876


AMBARI-15369. Ambari cannot enable NN HA in kerberos env (alexantonenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fe246287
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fe246287
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fe246287

Branch: refs/heads/branch-2.2
Commit: fe246287614dda63295b4f060ae1c825366de402
Parents: 13b5f2d
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Mar 10 18:01:02 2016 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Mar 11 14:51:37 2016 +0200

----------------------------------------------------------------------
 .../hawq/activateStandby/step3_controller.js    |  2 +-
 .../hawq/addStandby/step4_controller.js         |  2 +-
 .../nameNode/step5_controller.js                |  7 ++-
 .../nameNode/step9_controller.js                |  5 +-
 .../rangerAdmin/step4_controller.js             |  3 +-
 .../resourceManager/step4_controller.js         |  7 ++-
 .../wizard/wizardProgressPageController.js      | 16 ++++++-
 .../wizard/wizardProgressPageController_test.js | 49 ++++++++++++++++++--
 8 files changed, 70 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
index 7dbf992..8a99b1e 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
@@ -106,7 +106,7 @@ App.ActivateHawqStandbyWizardStep3Controller = App.HighAvailabilityProgressPageC
 
   installHawqMaster: function () {
     var hostName = this.get('content.hawqHosts.hawqStandby');
-    this.createComponent(this.hawqMasterComponentName, hostName, this.hawqServiceName);
+    this.createInstallComponentTask(this.hawqMasterComponentName, hostName, this.hawqServiceName);
   },
 
   deleteOldHawqMaster: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step4_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step4_controller.js
index 1409836..e468541 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/addStandby/step4_controller.js
@@ -36,7 +36,7 @@ App.AddHawqStandbyWizardStep4Controller = App.HighAvailabilityProgressPageContro
 
   installHawqStandbyMaster: function () {
     var hostName = this.get('content.hawqHosts.newHawqStandby');
-    this.createComponent('HAWQSTANDBY', hostName, "HAWQ");
+    this.createInstallComponentTask('HAWQSTANDBY', hostName, "HAWQ");
   },
 
   reconfigureHAWQ: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js
index 09e6d3c..15c0701 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step5_controller.js
@@ -29,12 +29,12 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont
 
   installNameNode: function () {
     var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').findProperty('isInstalled', false).hostName;
-    this.createComponent('NAMENODE', hostName, "HDFS");
+    this.createInstallComponentTask('NAMENODE', hostName, "HDFS");
   },
 
   installJournalNodes: function () {
     var hostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
-    this.createComponent('JOURNALNODE', hostNames, "HDFS");
+    this.createInstallComponentTask('JOURNALNODE', hostNames, "HDFS");
   },
 
   startJournalNodes: function () {
@@ -88,7 +88,7 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont
     var nnHostNames = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
     var jnHostNames = this.get('content.masterComponentHosts').filterProperty('component', 'JOURNALNODE').mapProperty('hostName');
     var hostNames = nnHostNames.concat(jnHostNames).uniq();
-    this.createComponent('HDFS_CLIENT', hostNames);
+    this.createInstallComponentTask('HDFS_CLIENT', hostNames, 'HDFS');
     App.router.get(this.get('content.controllerName')).saveHdfsClientHosts(hostNames);
     App.clusterStatus.setClusterStatus({
       clusterName: this.get('content.cluster.name'),
@@ -127,4 +127,3 @@ App.HighAvailabilityWizardStep5Controller = App.HighAvailabilityProgressPageCont
     this.updateConfigProperties(configItems);
   }
 });
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
index 934d133..404c54c 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step9_controller.js
@@ -60,7 +60,7 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
 
   installZKFC: function () {
     var hostName = this.get('content.masterComponentHosts').filterProperty('component', 'NAMENODE').mapProperty('hostName');
-    this.createComponent('ZKFC', hostName, "HDFS");
+    this.createInstallComponentTask('ZKFC', hostName, "HDFS");
   },
 
   startZKFC: function () {
@@ -85,7 +85,7 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
   },
 
   installPXF: function () {
-    this.createComponent('PXF', this.get('secondNameNodeHost'), "PXF");
+    this.createInstallComponentTask('PXF', this.get('secondNameNodeHost'), "PXF");
   },
 
   reconfigureHBase: function () {
@@ -162,4 +162,3 @@ App.HighAvailabilityWizardStep9Controller = App.HighAvailabilityProgressPageCont
   }
 
 });
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step4_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step4_controller.js
index 059280a..6562f3f 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/rangerAdmin/step4_controller.js
@@ -34,7 +34,7 @@ App.RAHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
 
   installRangerAdmin: function () {
     var hostNames = this.get('content.raHosts.additionalRA');
-    this.createComponent('RANGER_ADMIN', hostNames, "RANGER");
+    this.createInstallComponentTask('RANGER_ADMIN', hostNames, "RANGER");
   },
 
   reconfigureRanger: function () {
@@ -85,4 +85,3 @@ App.RAHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
     this.startServices(true);
   }
 });
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
index d50273b..dc681ea 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step4_controller.js
@@ -42,7 +42,7 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
 
   installResourceManager: function () {
     var hostName = this.get('content.rmHosts.additionalRM');
-    this.createComponent('RESOURCEMANAGER', hostName, "YARN");
+    this.createInstallComponentTask('RESOURCEMANAGER', hostName, "YARN");
   },
 
   reconfigureYARN: function () {
@@ -52,7 +52,7 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
   reconfigureHAWQ: function () {
     this.loadConfigsTags("yarn-client");
   },
-  
+
   reconfigureHDFS: function () {
     this.loadConfigsTags('core-site');
   },
@@ -100,7 +100,7 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
       error: 'onTaskError'
     });
   },
-  
+
   onSaveConfigs: function () {
     this.onTaskCompleted();
   },
@@ -109,4 +109,3 @@ App.RMHighAvailabilityWizardStep4Controller = App.HighAvailabilityProgressPageCo
     this.startServices(true);
   }
 });
-

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/app/mixins/wizard/wizardProgressPageController.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/wizardProgressPageController.js b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
index bd3f42c..4f32075 100644
--- a/ambari-web/app/mixins/wizard/wizardProgressPageController.js
+++ b/ambari-web/app/mixins/wizard/wizardProgressPageController.js
@@ -727,6 +727,20 @@ App.wizardProgressPageControllerMixin = Em.Mixin.create(App.InstallComponent, {
       this.removeObserver('tasks.@each.status', this, 'onTaskStatusChange');
       App.router.send('back');
     }
-  }
+  },
 
+  /**
+   * Same as <code>createComponent</code> but with kdc session check and status changes
+   * when KDC auth dialog dissmised.
+   *
+   * @see createComponent
+   */
+  createInstallComponentTask: function(componentName, hostName, serviceName, options) {
+    var self = this;
+    App.get('router.mainAdminKerberosController').getKDCSessionState(function() {
+      self.createComponent(componentName, hostName, serviceName);
+    }, function() {
+      self.onTaskError();
+    });
+  }
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/fe246287/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js b/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
index 84efaf5..360bf95 100644
--- a/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
+++ b/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
@@ -20,7 +20,7 @@ var App = require('app');
 
 describe('App.wizardProgressPageControllerMixin', function() {
   var mixedObject = Em.Object.extend(App.wizardProgressPageControllerMixin, {});
-  
+
   describe('#createComponent', function() {
     var mixedObjectInstance;
     beforeEach(function() {
@@ -66,7 +66,7 @@ describe('App.wizardProgressPageControllerMixin', function() {
       });
       App.serviceComponents = ['ZOOKEEPER_SERVER', 'ZOOKEEPER_CLIENT'];
     });
-    
+
     afterEach(function() {
       App.ajax.send.restore();
       App.StackServiceComponent.find.restore();
@@ -75,7 +75,7 @@ describe('App.wizardProgressPageControllerMixin', function() {
       mixedObjectInstance.updateComponent.restore();
       mixedObjectInstance.checkInstalledComponents.restore();
     });
-    
+
     it('should call `checkInstalledComponents` method', function() {
       mixedObjectInstance.createComponent('ZOOKEEPER_SERVER', 'host1', 'ZOOKEEPER');
       expect(mixedObjectInstance.checkInstalledComponents.called).to.be.true;
@@ -134,7 +134,7 @@ describe('App.wizardProgressPageControllerMixin', function() {
         ]
       }
     ];
-    
+
     testsAjax.forEach(function(test) {
       describe('called with params: ' + JSON.stringify(test.callParams), function() {
         before(function() {
@@ -146,7 +146,7 @@ describe('App.wizardProgressPageControllerMixin', function() {
         after(function() {
           App.ajax.send.restore();
         });
-        
+
         test.e.forEach(function(eKey) {
           it('key: {0} should have value: {1}'.format(eKey.key, eKey.value), function() {
             var args = App.ajax.send.args[0][0];
@@ -157,5 +157,44 @@ describe('App.wizardProgressPageControllerMixin', function() {
     });
   });
 
+  describe('#createInstallComponentTask', function() {
+    var mixedObjectInstance;
+    beforeEach(function() {
+      mixedObjectInstance = mixedObject.create({});
+      sinon.stub(mixedObjectInstance, 'createComponent', Em.K);
+      sinon.stub(mixedObjectInstance, 'onTaskError', Em.K);
+      this.KDCStub = sinon.stub(App, 'get').withArgs('router.mainAdminKerberosController');
+    });
+
+    afterEach(function() {
+      mixedObjectInstance.createComponent.restore();
+      mixedObjectInstance.onTaskError.restore();
+      mixedObjectInstance.destroy();
+      mixedObjectInstance = null;
+      App.get.restore();
+      this.KDCStub = null;
+    });
+
+    it('when credentials are ok, createComponent method called', function() {
+      this.KDCStub.returns({
+        getKDCSessionState: function(sCallback, eCallback) {
+          sCallback();
+        }
+      });
+      mixedObjectInstance.createInstallComponentTask('componentName', 'hostName', 'serviceName');
+      assert.isTrue(mixedObjectInstance.createComponent.calledOnce, 'createComponent should be called');
+      assert.equal(JSON.stringify(mixedObjectInstance.createComponent.args[0]), JSON.stringify(['componentName', 'hostName', 'serviceName']), 'passed argument order should be the same');
+    });
 
+    it('when credentials are expired and KDC dialog cancelled task status should be changed to failed', function() {
+      this.KDCStub.returns({
+        getKDCSessionState: function(sCallback, eCallback) {
+          eCallback();
+        }
+      });
+      mixedObjectInstance.createInstallComponentTask('componentName', 'hostName', 'serviceName');
+      assert.isFalse(mixedObjectInstance.createComponent.calledOnce, 'createComponent should not be called');
+      assert.isTrue(mixedObjectInstance.onTaskError.called, 'onTaskError handler called');
+    });
+  });
 });