ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ababiic...@apache.org
Subject git commit: AMBARI-7759 Storm Start fails because of malformed childopts. (Buzhor Denys via ababiichuk)
Date Mon, 13 Oct 2014 16:39:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-1.7.0 a02000468 -> e4743acd6


AMBARI-7759 Storm Start fails because of malformed childopts. (Buzhor Denys via ababiichuk)


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

Branch: refs/heads/branch-1.7.0
Commit: e4743acd65561b610112215860d51babd2f591f6
Parents: a020004
Author: aBabiichuk <ababiichuk@cybervisiontech.com>
Authored: Mon Oct 13 19:38:55 2014 +0300
Committer: aBabiichuk <ababiichuk@cybervisiontech.com>
Committed: Mon Oct 13 19:38:55 2014 +0300

----------------------------------------------------------------------
 .../app/controllers/wizard/step8_controller.js  |  9 ++-------
 .../test/controllers/wizard/step8_test.js       | 21 ++++++++++----------
 2 files changed, 13 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e4743acd/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index b975f01..ba55429 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -1654,14 +1654,9 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs,
{
   createStormSiteObj: function (tag) {
     var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
     var stormProperties = {};
-    var specialProperties = ["storm.zookeeper.servers", "nimbus.childopts", "supervisor.childopts",
"worker.childopts"];
     configs.forEach(function (_configProperty) {
-      if (specialProperties.contains(_configProperty.name)) {
-        if (_configProperty.name == "storm.zookeeper.servers") {
-          stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g,
"'");
-        } else {
-          stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g,
"");
-        }
+      if (_configProperty.name == "storm.zookeeper.servers") {
+        stormProperties[_configProperty.name] = JSON.stringify(_configProperty.value).replace(/"/g,
"'");
       } else {
         stormProperties[_configProperty.name] = _configProperty.value;
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e4743acd/ambari-web/test/controllers/wizard/step8_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js
index 3f061d0..f544e88 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -924,33 +924,34 @@ describe('App.WizardStep8Controller', function () {
   });
 
   describe('#createStormSiteObj', function() {
-    it('should remove quotes for some properties', function() {
+    it('should replace quote \'"\' to "\'" for some properties', function() {
       var configs = [
-          {filename: 'storm-site.xml', value: ["a", "b"], name: 'nimbus.childopts'},
-          {filename: 'storm-site.xml', value: ["a", "b"], name: 'supervisor.childopts'},
-          {filename: 'storm-site.xml', value: ["a", "b"], name: 'worker.childopts'}
+          {filename: 'storm-site.xml', value: ["a", "b"], name: 'storm.zookeeper.servers'}
         ],
         expected = {
           type: 'storm-site',
           tag: 'version1',
           properties: {
-            'nimbus.childopts': '[a,b]',
-            'supervisor.childopts': '[a,b]',
-            'worker.childopts': '[a,b]'
+            'storm.zookeeper.servers': '[\'a\',\'b\']'
           }
         };
       installerStep8Controller.reopen({configs: configs});
       expect(installerStep8Controller.createStormSiteObj('version1')).to.eql(expected);
     });
-    it('should replace quote \'"\' to "\'" for some properties', function() {
+
+    it('should not escape special characters', function() {
       var configs = [
-          {filename: 'storm-site.xml', value: ["a", "b"], name: 'storm.zookeeper.servers'}
+          {filename: 'storm-site.xml', value: "abc\n\t", name: 'nimbus.childopts'},
+          {filename: 'storm-site.xml', value: "a\nb", name: 'supervisor.childopts'},
+          {filename: 'storm-site.xml', value: "a\t\tb", name: 'worker.childopts'}
         ],
         expected = {
           type: 'storm-site',
           tag: 'version1',
           properties: {
-            'storm.zookeeper.servers': '[\'a\',\'b\']'
+            'nimbus.childopts': 'abc\n\t',
+            'supervisor.childopts': 'a\nb',
+            'worker.childopts': 'a\t\tb'
           }
         };
       installerStep8Controller.reopen({configs: configs});


Mime
View raw message