Browse Source

AMBARI-4783 Storm: Incorrect value of storm.zookeeper.servers property after saving configs. (Denys Buzhor via atkach)

atkach 11 năm trước cách đây
mục cha
commit
ba2c2a080a
1 tập tin đã thay đổi với 21 bổ sung1 xóa
  1. 21 1
      ambari-web/app/controllers/main/service/info/configs.js

+ 21 - 1
ambari-web/app/controllers/main/service/info/configs.js

@@ -1425,11 +1425,31 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
   createSiteObj: function (siteName, tagName, siteObj) {
     var siteProperties = {};
     siteObj.forEach(function (_siteObj) {
-      siteProperties[_siteObj.name] = App.config.escapeXMLCharacters(_siteObj.value);
+      siteProperties[_siteObj.name] = this.setServerConfigValue(_siteObj.name, _siteObj.value);
       //this.recordHostOverride(_siteObj, siteName, tagName, this);
     }, this);
     return {"type": siteName, "tag": tagName, "properties": siteProperties};
   },
+  /**
+   * This method will be moved to config's decorators class.
+   *
+   * For now, provide handling for special properties that need
+   * be specified in special format required for server.
+   *
+   * @param configName {String} - name of config property
+   * @param value {Mixed} - value of config property
+   *
+   * @return {String} - formated value
+   */
+  setServerConfigValue: function (configName, value) {
+    switch (configName) {
+      case 'storm.zookeeper.servers':
+        return JSON.stringify(value).replace(/"/g, "'");
+        break;
+      default:
+        return App.config.escapeXMLCharacters(value);
+    }
+  },
   /**
    * return either specific url for request if testMode is false or testUrl
    * @param testUrl