You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2015/09/03 21:57:40 UTC

ambari git commit: AMBARI-12856. Ambari UI should not restrict core-site to be only part of HDFS service

Repository: ambari
Updated Branches:
  refs/heads/trunk b8a38d766 -> 4ff26efb1


AMBARI-12856. Ambari UI should not restrict core-site to be only part of HDFS service


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

Branch: refs/heads/trunk
Commit: 4ff26efb178a2ef410a0ab20a865b6fe76ab8957
Parents: b8a38d7
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Thu Sep 3 12:57:21 2015 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Thu Sep 3 12:57:21 2015 -0700

----------------------------------------------------------------------
 .../server/state/cluster/ClusterImpl.java       |  5 +-
 .../YARN/2.1.0.2.0/package/scripts/yarn.py      | 17 +++----
 .../app/controllers/wizard/step4_controller.js  | 32 +++++++------
 .../app/mixins/common/configs/configs_saver.js  |  4 +-
 .../mixins/common/configs/configs_saver_test.js | 49 ++++++++++++++++----
 5 files changed, 73 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff26efb/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
index 3b0e3d8..a48fb54 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java
@@ -2386,8 +2386,9 @@ public class ClusterImpl implements Cluster {
             serviceName = entry.getKey();
             break;
           } else if (!serviceName.equals(entry.getKey())) {
-            String error = "Updating configs for multiple services by a " +
-                "single API request isn't supported";
+            String error = String.format("Updating configs for multiple services by a " +
+                "single API request isn't supported. Conflicting services %s and %s for %s",
+                                         serviceName, entry.getKey(), config.getType());
             IllegalArgumentException exception = new IllegalArgumentException(error);
             LOG.error(error + ", config version not created for {}", serviceName);
             throw exception;

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff26efb/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
index 542a5fe..21906ba 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
@@ -172,14 +172,15 @@ def yarn(name = None):
   # During RU, Core Masters and Slaves need hdfs-site.xml
   # TODO, instead of specifying individual configs, which is susceptible to breaking when new configs are added,
   # RU should rely on all available in /usr/hdp/<version>/hadoop/conf
-  XmlConfig("hdfs-site.xml",
-            conf_dir=params.hadoop_conf_dir,
-            configurations=params.config['configurations']['hdfs-site'],
-            configuration_attributes=params.config['configuration_attributes']['hdfs-site'],
-            owner=params.hdfs_user,
-            group=params.user_group,
-            mode=0644
-  )
+  if 'hdfs-site' in params.config['configurations']:
+    XmlConfig("hdfs-site.xml",
+              conf_dir=params.hadoop_conf_dir,
+              configurations=params.config['configurations']['hdfs-site'],
+              configuration_attributes=params.config['configuration_attributes']['hdfs-site'],
+              owner=params.hdfs_user,
+              group=params.user_group,
+              mode=0644
+    )
 
   XmlConfig("mapred-site.xml",
             conf_dir=params.hadoop_conf_dir,

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff26efb/ambari-web/app/controllers/wizard/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step4_controller.js b/ambari-web/app/controllers/wizard/step4_controller.js
index 3a545a3..3a83500 100644
--- a/ambari-web/app/controllers/wizard/step4_controller.js
+++ b/ambari-web/app/controllers/wizard/step4_controller.js
@@ -279,21 +279,23 @@ App.WizardStep4Controller = Em.ArrayController.extend({
   fileSystemServiceValidation: function() {
     if(this.isDFSStack()){
       var primaryDFS = this.findProperty('isPrimaryDFS',true);
-      var primaryDfsDisplayName = primaryDFS.get('displayNameOnSelectServicePage');
-      var primaryDfsServiceName = primaryDFS.get('serviceName');
-      if (this.multipleDFSs()) {
-        var dfsServices = this.filterProperty('isDFS',true).filterProperty('isSelected',true).mapProperty('serviceName');
-        var services = dfsServices.map(function (item){
-          return  {
-            serviceName: item,
-            selected: item === primaryDfsServiceName
-          };
-        });
-        this.addValidationError({
-          id: 'multipleDFS',
-          callback: this.needToAddServicePopup,
-          callbackParams: [services, 'multipleDFS', primaryDfsDisplayName]
-        });
+      if (primaryDFS) {
+        var primaryDfsDisplayName = primaryDFS.get('displayNameOnSelectServicePage');
+        var primaryDfsServiceName = primaryDFS.get('serviceName');
+        if (this.multipleDFSs()) {
+          var dfsServices = this.filterProperty('isDFS',true).filterProperty('isSelected',true).mapProperty('serviceName');
+          var services = dfsServices.map(function (item){
+            return  {
+              serviceName: item,
+              selected: item === primaryDfsServiceName
+            };
+          });
+          this.addValidationError({
+            id: 'multipleDFS',
+            callback: this.needToAddServicePopup,
+            callbackParams: [services, 'multipleDFS', primaryDfsDisplayName]
+          });
+        }
       }
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff26efb/ambari-web/app/mixins/common/configs/configs_saver.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_saver.js b/ambari-web/app/mixins/common/configs/configs_saver.js
index b80309e..906f9c6 100644
--- a/ambari-web/app/mixins/common/configs/configs_saver.js
+++ b/ambari-web/app/mixins/common/configs/configs_saver.js
@@ -491,7 +491,9 @@ App.ConfigsSaverMixin = Em.Mixin.create({
       case 'mapred-queue-acls.xml':
         return false;
       case 'core-site.xml':
-        return ['HDFS', 'GLUSTERFS', 'RANGER_KMS'].contains(this.get('content.serviceName'));
+        var serviceName = this.get('content.serviceName');
+        var serviceType = App.StackService.find().findProperty('serviceName',serviceName).get('serviceType');
+        return ['HDFS', 'GLUSTERFS', 'RANGER_KMS'].contains(this.get('content.serviceName')) || serviceType === 'HCFS';
       default :
         return true;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4ff26efb/ambari-web/test/mixins/common/configs/configs_saver_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/configs_saver_test.js b/ambari-web/test/mixins/common/configs/configs_saver_test.js
index d8b3cb3..5bf6f26 100644
--- a/ambari-web/test/mixins/common/configs/configs_saver_test.js
+++ b/ambari-web/test/mixins/common/configs/configs_saver_test.js
@@ -23,27 +23,60 @@ describe('App.ConfigsSaverMixin', function() {
   var instanceObject = mixinObject.create({});
 
   describe('#allowSaveSite()', function() {
-
+    var stackServices = [
+      Em.Object.create({
+        serviceName: 'HDFS',
+        serviceType: 'NONHCFS'
+      }),
+      Em.Object.create({
+        serviceName: 'S1',
+        serviceType: 'HCFS'
+      }),
+      Em.Object.create({
+        serviceName: 'S2',
+        serviceType: 'NONHCFS'
+      }),
+      Em.Object.create({
+        serviceName: 'S3'
+      })
+    ];
     beforeEach(function() {
       instanceObject.set('content', {});
+      sinon.stub(App.StackService, 'find', function () {
+        return stackServices;
+      });
+    });
+
+    afterEach(function() {
+      App.StackService.find.restore();
     });
 
     it('returns true by default', function() {
       expect(instanceObject.allowSaveSite('some-site')).to.be.true
     });
 
-    it('returns false for mapred-queue-acls.xml', function() {
-      expect(instanceObject.allowSaveSite('mapred-queue-acls.xml')).to.be.false
+    it('returns true for core-site and proper service', function() {
+      instanceObject.set('content.serviceName', 'HDFS');
+      expect(instanceObject.allowSaveSite('core-site.xml')).to.be.true
     });
 
-    it('returns false for core-site but not proper service', function() {
-      instanceObject.set('content.serviceName', 'ANY');
+    it('returns true for core-site and serviceType HCFS', function() {
+      instanceObject.set('content.serviceName', 'S1');
+      expect(instanceObject.allowSaveSite('core-site.xml')).to.be.true
+    });
+
+    it('returns false for core-site and serviceType not HCFS', function() {
+      instanceObject.set('content.serviceName', 'S2');
       expect(instanceObject.allowSaveSite('core-site.xml')).to.be.false
     });
 
-    it('returns true for core-site and proper service', function() {
-      instanceObject.set('content.serviceName', 'HDFS');
-      expect(instanceObject.allowSaveSite('core-site.xml')).to.be.true
+    it('returns false for core-site but serviceType undefined', function() {
+      instanceObject.set('content.serviceName', 'S3');
+      expect(instanceObject.allowSaveSite('core-site.xml')).to.be.false
+    });
+
+    it('returns false for mapred-queue-acls.xml', function() {
+      expect(instanceObject.allowSaveSite('mapred-queue-acls.xml')).to.be.false
     });
   });