ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-9873. Restart Yarn failed after Ambari only upgrade from 1.6.1 to 2.0.0 and adding Host and Zookeeper Server at this host. (alexantonenko)
Date Mon, 02 Mar 2015 17:59:43 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 455a0a804 -> dda261fa9


AMBARI-9873. Restart Yarn failed after Ambari only upgrade from 1.6.1 to 2.0.0 and adding
Host and Zookeeper Server at this host. (alexantonenko)


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

Branch: refs/heads/branch-2.0.0
Commit: dda261fa9deeca4dc708642e49d96efd21000667
Parents: 455a0a8
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Mon Mar 2 19:35:12 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Mon Mar 2 19:58:21 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 22 +++---
 .../test/controllers/main/host/details_test.js  | 74 ++++++++++++++++++++
 2 files changed, 87 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dda261fa/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 3adb742..5eac7ca 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -696,7 +696,7 @@ App.MainHostDetailsController = Em.Controller.extend({
         properties = group.properties;
 
       for (var site in properties) {
-        if (!properties.hasOwnProperty(site)) continue;
+        if (!properties.hasOwnProperty(site) || Em.isNone(properties[site])) continue;
         desiredConfigs.push({
           "type": site,
           "tag": tag,
@@ -917,16 +917,20 @@ App.MainHostDetailsController = Em.Controller.extend({
           'hive-site': attributes['hive-site'],
           'webhcat-site': attributes['webhcat-site']
         }
-      },
-      {
-        properties: {
-          'yarn-site': configs['yarn-site']
-        },
-        properties_attributes: {
-          'yarn-site': attributes['yarn-site']
-        }
       }
     ];
+    if ((App.Service.find().someProperty('serviceName', 'YARN') && App.get('isHadoop22Stack'))
|| App.get('isRMHaEnabled')) {
+      groups.push(
+        {
+          properties: {
+            'yarn-site': configs['yarn-site']
+          },
+          properties_attributes: {
+            'yarn-site': attributes['yarn-site']
+          }
+        }
+      );
+    }
     this.saveConfigsBatch(groups);
   },
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/dda261fa/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 8f23915..b9612e4 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -682,6 +682,61 @@ describe('App.MainHostDetailsController', function () {
 
   describe('#saveZkConfigs()', function () {
 
+    var yarnCases = [
+        {
+          isYARNInstalled: true,
+          isHadoop22Stack: true,
+          isRMHaEnabled: true,
+          shouldYarnSiteBeModified: true,
+          title: 'HDP 2.2, YARN installed, RM HA enabled'
+        },
+        {
+          isYARNInstalled: true,
+          isHadoop22Stack: false,
+          isRMHaEnabled: true,
+          shouldYarnSiteBeModified: true,
+          title: 'HDP < 2.2, YARN installed, RM HA enabled'
+        },
+        {
+          isYARNInstalled: true,
+          isHadoop22Stack: true,
+          isRMHaEnabled: false,
+          shouldYarnSiteBeModified: true,
+          title: 'HDP 2.2, YARN installed, RM HA disabled'
+        },
+        {
+          isYARNInstalled: false,
+          isHadoop22Stack: true,
+          isRMHaEnabled: false,
+          shouldYarnSiteBeModified: false,
+          title: 'HDP 2.2, YARN not installed'
+        },
+        {
+          isYARNInstalled: true,
+          isHadoop22Stack: false,
+          isRMHaEnabled: false,
+          shouldYarnSiteBeModified: false,
+          title: 'HDP < 2.2, YARN installed, RM HA disabled'
+        },
+        {
+          isYARNInstalled: false,
+          isHadoop22Stack: false,
+          isRMHaEnabled: false,
+          shouldYarnSiteBeModified: false,
+          title: 'HDP < 2.2, YARN not installed'
+        }
+      ],
+      yarnData = {
+        items: [
+          {
+            type: 'yarn-site',
+            properties: {
+              p: 'v'
+            }
+          }
+        ]
+      };
+
     beforeEach(function () {
       sinon.stub(controller, "getZkServerHosts", Em.K);
       sinon.stub(controller, "concatZkNames", Em.K);
@@ -700,6 +755,25 @@ describe('App.MainHostDetailsController', function () {
       controller.saveZkConfigs(data);
       expect(controller.saveConfigsBatch.calledOnce).to.be.true;
     });
+
+    yarnCases.forEach(function (item) {
+      it(item.title, function () {
+        var servicesMock = item.isYARNInstalled ? [
+          {
+            serviceName: 'YARN'
+          }
+        ] : [];
+        sinon.stub(App, 'get').withArgs('isHadoop22Stack').returns(item.isHadoop22Stack).
+          withArgs('isRMHaEnabled').returns(item.isRMHaEnabled);
+        sinon.stub(App.Service, 'find').returns(servicesMock);
+        controller.saveZkConfigs(yarnData);
+        expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
+        expect(controller.saveConfigsBatch.firstCall.args[0].someProperty('properties_attributes.yarn-site')).to.equal(item.shouldYarnSiteBeModified);
+        App.get.restore();
+        App.Service.find.restore();
+      });
+    });
+
   });
 
   describe("#saveConfigsBatch()", function() {


Mime
View raw message