Repository: ambari
Updated Branches:
  refs/heads/trunk 9ce0a12e1 -> 6b4f40695


AMBARI-20404. Enhance error message for invalid chars in properties/values 
(aonishuk)


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

Branch: refs/heads/trunk
Commit: 6b4f406958d2bbfdfbd597bfe97befc8cba66d76
Parents: 9ce0a12
Author: Andrew Onishuk <[email protected]>
Authored: Mon Mar 20 14:03:29 2017 +0200
Committer: Andrew Onishuk <[email protected]>
Committed: Mon Mar 20 14:03:29 2017 +0200

----------------------------------------------------------------------
 ambari-common/src/main/python/resource_management/core/source.py   | 2 +-
 .../resource_management/libraries/providers/properties_file.py     | 2 +-
 .../python/resource_management/libraries/providers/xml_config.py   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6b4f4069/ambari-common/src/main/python/resource_management/core/source.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/source.py 
b/ambari-common/src/main/python/resource_management/core/source.py
index e31f7d6..6ea8edb 100644
--- a/ambari-common/src/main/python/resource_management/core/source.py
+++ b/ambari-common/src/main/python/resource_management/core/source.py
@@ -137,7 +137,7 @@ else:
       self.template = self.template_env.get_template(self.name)     
     
     def get_content(self):
-      default_variables = { 'env':self.env, 'repr':repr, 'str':str, 
'bool':bool }
+      default_variables = { 'env':self.env, 'repr':repr, 'str':str, 
'bool':bool, 'unicode':unicode }
       variables = checked_unite(default_variables, self.imports_dict)
       self.context.update(variables)
       

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b4f4069/ambari-common/src/main/python/resource_management/libraries/providers/properties_file.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/providers/properties_file.py
 
b/ambari-common/src/main/python/resource_management/libraries/providers/properties_file.py
index 2bf1f5b..283cc3f 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/providers/properties_file.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/providers/properties_file.py
@@ -42,7 +42,7 @@ class PropertiesFileProvider(Provider):
 
     config_content = InlineTemplate('''# Generated by Apache Ambari. 
{{time.asctime(time.localtime())}}
     {% for key, value in properties_dict|dictsort %}
-{{key}}{{key_value_delimiter}}{{ 
resource_management.core.source.InlineTemplate(str(value)).get_content() }}{% 
endfor %}
+{{key}}{{key_value_delimiter}}{{ 
resource_management.core.source.InlineTemplate(unicode(value)).get_content() 
}}{% endfor %}
     ''', extra_imports=[time, resource_management, resource_management.core, 
resource_management.core.source], properties_dict=self.resource.properties, 
key_value_delimiter=self.resource.key_value_delimiter)
 
     Logger.info(format("Generating properties file: {filepath}"))

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b4f4069/ambari-common/src/main/python/resource_management/libraries/providers/xml_config.py
----------------------------------------------------------------------
diff --git 
a/ambari-common/src/main/python/resource_management/libraries/providers/xml_config.py
 
b/ambari-common/src/main/python/resource_management/libraries/providers/xml_config.py
index c885d6e..28697bf 100644
--- 
a/ambari-common/src/main/python/resource_management/libraries/providers/xml_config.py
+++ 
b/ambari-common/src/main/python/resource_management/libraries/providers/xml_config.py
@@ -40,7 +40,7 @@ class XmlConfigProvider(Provider):
     {% for key, value in configurations_dict|dictsort %}
     <property>
       <name>{{ key|e }}</name>
-      <value>{{ 
resource_management.core.source.InlineTemplate(str(value)).get_content() |e 
}}</value>
+      <value>{{ 
resource_management.core.source.InlineTemplate(unicode(value)).get_content() |e 
}}</value>
       {%- if not configuration_attrs is none -%}
       {%- for attrib_name, attrib_occurances in  configuration_attrs.items() 
-%}
       {%- for property_name, attrib_value in  attrib_occurances.items() -%}

Reply via email to