This is an automated email from the ASF dual-hosted git repository.

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 55faaed  AMBARI-23623 Enable NameNode HA fails if Ranger is set up 
with Ambari-managed Hive MySQL DB instance
55faaed is described below

commit 55faaed088a02740c692e3d4357deeef87f8790c
Author: Andrii Tkach <[email protected]>
AuthorDate: Thu Apr 19 15:48:36 2018 +0300

    AMBARI-23623 Enable NameNode HA fails if Ranger is set up with 
Ambari-managed Hive MySQL DB instance
---
 .../highAvailability/nameNode/step7_controller.js  | 18 +++++++++++----
 ambari-web/app/messages.js                         |  5 +++--
 .../nameNode/step7_controller_test.js              | 26 ++++++++++++++++++++--
 3 files changed, 41 insertions(+), 8 deletions(-)

diff --git 
a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step7_controller.js
 
b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step7_controller.js
index f4b6ff7..722668c 100644
--- 
a/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step7_controller.js
+++ 
b/ambari-web/app/controllers/main/admin/highAvailability/nameNode/step7_controller.js
@@ -22,19 +22,24 @@ App.HighAvailabilityWizardStep7Controller = 
App.HighAvailabilityProgressPageCont
 
   name:"highAvailabilityWizardStep7Controller",
 
-  commands: ['startZooKeeperServers', 'startAmbariInfra', 'startRanger', 
'startNameNode'],
+  commands: ['startZooKeeperServers', 'startAmbariInfra', 'startMysqlServer', 
'startRanger', 'startNameNode'],
 
   initializeTasks: function () {
     this._super();
-    var tasksToRemove = [];
+    const tasksToRemove = [];
 
-    if (!App.Service.find().someProperty('serviceName', 'AMBARI_INFRA_SOLR')) {
+    if (!App.Service.find('AMBARI_INFRA_SOLR').get('isLoaded')) {
       tasksToRemove.push('startAmbariInfra');
     }
 
-    if (!App.Service.find().someProperty('serviceName', 'RANGER')) {
+    if 
(App.ClientComponent.getModelByComponentName('RANGER_ADMIN').get('installedCount')
 === 0) {
       tasksToRemove.push('startRanger');
     }
+
+    if 
(App.ClientComponent.getModelByComponentName('MYSQL_SERVER').get('installedCount')
 === 0) {
+      tasksToRemove.push('startMysqlServer');
+    }
+
     this.removeTasks(tasksToRemove);
   },
 
@@ -49,6 +54,11 @@ App.HighAvailabilityWizardStep7Controller = 
App.HighAvailabilityProgressPageCont
     }
   },
 
+  startMysqlServer: function () {
+    const hostNames = 
App.MasterComponent.find('MYSQL_SERVER').get('hostNames');
+    this.updateComponent('MYSQL_SERVER', hostNames, "HIVE", "Start");
+  },
+
   startZooKeeperServers: function () {
     var hostNames = 
this.get('content.masterComponentHosts').filterProperty('component', 
'ZOOKEEPER_SERVER').mapProperty('hostName');
     this.updateComponent('ZOOKEEPER_SERVER', hostNames, "ZOOKEEPER", "Start");
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index b699e0d..9f1e4ca 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1497,8 +1497,9 @@ Em.I18n.translations = {
 
   'admin.highAvailability.wizard.step7.task0.title':'Start ZooKeeper Servers',
   'admin.highAvailability.wizard.step7.task1.title':'Start Ambari Infra',
-  'admin.highAvailability.wizard.step7.task2.title':'Start Ranger',
-  'admin.highAvailability.wizard.step7.task3.title':'Start NameNode',
+  'admin.highAvailability.wizard.step7.task2.title':'Start Mysql Server',
+  'admin.highAvailability.wizard.step7.task3.title':'Start Ranger',
+  'admin.highAvailability.wizard.step7.task4.title':'Start NameNode',
 
   'admin.highAvailability.wizard.step9.task0.title':'Start Additional 
NameNode',
   'admin.highAvailability.wizard.step9.task1.title':'Install Failover 
Controllers',
diff --git 
a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step7_controller_test.js
 
b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step7_controller_test.js
index 09b70e6..848ba28 100644
--- 
a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step7_controller_test.js
+++ 
b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step7_controller_test.js
@@ -30,16 +30,20 @@ describe('App.HighAvailabilityWizardStep7Controller', 
function() {
   describe('#initializeTasks', function() {
     beforeEach(function() {
       sinon.stub(controller, 'removeTasks');
-      sinon.stub(App.Service, 'find').returns([]);
+      sinon.stub(App.Service, 'find').returns(Em.Object.create({isLoaded: 
false}));
+      sinon.stub(App.ClientComponent, 
'getModelByComponentName').returns(Em.Object.create({
+        installedCount: 0
+      }));
     });
     afterEach(function() {
       controller.removeTasks.restore();
       App.Service.find.restore();
+      App.ClientComponent.getModelByComponentName.restore();
     });
 
     it('removeTasks should be called', function() {
       controller.initializeTasks();
-      expect(controller.removeTasks.calledWith(['startAmbariInfra', 
'startRanger'])).to.be.true;
+      expect(controller.removeTasks.calledWith(['startAmbariInfra', 
'startRanger', 'startMysqlServer'])).to.be.true;
     });
   });
 
@@ -77,6 +81,24 @@ describe('App.HighAvailabilityWizardStep7Controller', 
function() {
     });
   });
 
+  describe('#startMysqlServer', function() {
+    beforeEach(function() {
+      sinon.stub(App.MasterComponent, 'find').returns(Em.Object.create({
+        hostNames: ['host1']
+      }));
+      sinon.stub(controller, 'updateComponent');
+    });
+    afterEach(function() {
+      App.MasterComponent.find.restore();
+      controller.updateComponent.restore();
+    });
+
+    it('updateComponent should be called', function() {
+      controller.startMysqlServer();
+      expect(controller.updateComponent.calledWith('MYSQL_SERVER', ['host1'], 
"HIVE", "Start")).to.be.true;
+    });
+  });
+
   describe('#startZooKeeperServers', function() {
     beforeEach(function() {
       sinon.stub(controller, 'updateComponent');

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to