You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/06/13 17:01:40 UTC

[2/2] ambari git commit: AMBARI-11782. DataNode directories overrides values with "\n" symbol (onechiporenko)

AMBARI-11782. DataNode directories overrides values with "\n" symbol (onechiporenko)


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

Branch: refs/heads/trunk
Commit: 91ec0fb8601c87d27a734ac80a43c2a0c55275ed
Parents: d580761
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Sat Jun 13 14:28:09 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Sat Jun 13 18:01:02 2015 +0300

----------------------------------------------------------------------
 .../configs/objects/service_config_property.js     |  2 +-
 .../objects/service_config_property_test.js        | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/91ec0fb8/ambari-web/app/models/configs/objects/service_config_property.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/configs/objects/service_config_property.js b/ambari-web/app/models/configs/objects/service_config_property.js
index a2ef828..089b249 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -538,7 +538,7 @@ App.ServiceConfigProperty = Em.Object.extend({
     value = '' + value;
     switch(this.get('displayType')) {
       case 'directories':
-        return value.replace(/(\n\r?)+/g, '\n');
+        return value.replace(/(\n\r?)+/g, '\n').trim();
         break;
       default:
         return value;

http://git-wip-us.apache.org/repos/asf/ambari/blob/91ec0fb8/ambari-web/test/models/configs/objects/service_config_property_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_property_test.js b/ambari-web/test/models/configs/objects/service_config_property_test.js
index b52bad9..8541668 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -581,6 +581,19 @@ describe('App.ServiceConfigProperty', function () {
             value: "/hadoop/hdfs/data\n"
           })
         }
+      },
+      {
+        m: '`directories`-config with almost equal value (2)',
+        e: true,
+        c: {
+          value: "/hadoop/hdfs/data",
+          displayType: 'directories',
+          supportsFinal: false,
+          isOriginalSCP: false,
+          parentSCP: App.ServiceConfigProperty.create({
+            value: "/hadoop/hdfs/data\n"
+          })
+        }
       }
     ]).forEach(function (test) {
       it(test.m, function () {
@@ -643,11 +656,11 @@ describe('App.ServiceConfigProperty', function () {
     });
 
     it('should trim value', function () {
-      expect(serviceConfigProperty._getValueForCheck(serviceConfigProperty.get('value'))).to.equal('/hadoop/hdfs/data\n');
+      expect(serviceConfigProperty._getValueForCheck(serviceConfigProperty.get('value'))).to.equal('/hadoop/hdfs/data');
     });
 
     it('should trim value 2', function () {
-      expect(serviceConfigProperty._getValueForCheck(serviceConfigProperty.get('overrides.0.value'))).to.equal('/hadoop/hdfs/data\n');
+      expect(serviceConfigProperty._getValueForCheck(serviceConfigProperty.get('overrides.0.value'))).to.equal('/hadoop/hdfs/data');
     });
 
   });