ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject [1/2] ambari git commit: AMBARI-11782. DataNode directories overrides values with "\n" symbol (onechiporenko)
Date Sat, 13 Jun 2015 14:59:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 ccc2af97c -> fade596e0


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/13aad89e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/13aad89e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/13aad89e

Branch: refs/heads/branch-2.1
Commit: 13aad89ee84593510e09e276b22eed4f10acd500
Parents: ccc2af9
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Sat Jun 13 14:28:09 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Sat Jun 13 14:28:09 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/13aad89e/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 799c79f..ed64387 100644
--- a/ambari-web/app/models/configs/objects/service_config_property.js
+++ b/ambari-web/app/models/configs/objects/service_config_property.js
@@ -530,7 +530,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/13aad89e/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 c932d87..4eaa522 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');
     });
 
   });


Mime
View raw message