소스 검색

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

aBabiichuk 10 년 전
부모
커밋
5af225e60b
2개의 변경된 파일13개의 추가작업 그리고 17개의 파일을 삭제
  1. 2 7
      ambari-web/app/controllers/wizard/step8_controller.js
  2. 11 10
      ambari-web/test/controllers/wizard/step8_test.js

+ 2 - 7
ambari-web/app/controllers/wizard/step8_controller.js

@@ -1654,14 +1654,9 @@ App.WizardStep8Controller = Em.Controller.extend(App.AddSecurityConfigs, {
   createStormSiteObj: function (tag) {
   createStormSiteObj: function (tag) {
     var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
     var configs = this.get('configs').filterProperty('filename', 'storm-site.xml');
     var stormProperties = {};
     var stormProperties = {};
-    var specialProperties = ["storm.zookeeper.servers", "nimbus.childopts", "supervisor.childopts", "worker.childopts"];
     configs.forEach(function (_configProperty) {
     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 {
       } else {
         stormProperties[_configProperty.name] = _configProperty.value;
         stormProperties[_configProperty.name] = _configProperty.value;
       }
       }

+ 11 - 10
ambari-web/test/controllers/wizard/step8_test.js

@@ -924,33 +924,34 @@ describe('App.WizardStep8Controller', function () {
   });
   });
 
 
   describe('#createStormSiteObj', function() {
   describe('#createStormSiteObj', function() {
-    it('should remove quotes for some properties', function() {
+    it('should replace quote \'"\' to "\'" for some properties', function() {
       var configs = [
       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 = {
         expected = {
           type: 'storm-site',
           type: 'storm-site',
           tag: 'version1',
           tag: 'version1',
           properties: {
           properties: {
-            'nimbus.childopts': '[a,b]',
-            'supervisor.childopts': '[a,b]',
-            'worker.childopts': '[a,b]'
+            'storm.zookeeper.servers': '[\'a\',\'b\']'
           }
           }
         };
         };
       installerStep8Controller.reopen({configs: configs});
       installerStep8Controller.reopen({configs: configs});
       expect(installerStep8Controller.createStormSiteObj('version1')).to.eql(expected);
       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 = [
       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 = {
         expected = {
           type: 'storm-site',
           type: 'storm-site',
           tag: 'version1',
           tag: 'version1',
           properties: {
           properties: {
-            'storm.zookeeper.servers': '[\'a\',\'b\']'
+            'nimbus.childopts': 'abc\n\t',
+            'supervisor.childopts': 'a\nb',
+            'worker.childopts': 'a\t\tb'
           }
           }
         };
         };
       installerStep8Controller.reopen({configs: configs});
       installerStep8Controller.reopen({configs: configs});