You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2014/07/31 12:17:07 UTC

git commit: AMBARI-6674. potential language/encoding problem with mysql (aonishuk)

Repository: ambari
Updated Branches:
  refs/heads/trunk a74269397 -> 68b97f035


AMBARI-6674. potential language/encoding problem with mysql (aonishuk)


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

Branch: refs/heads/trunk
Commit: 68b97f03550fd08e9bc330df92e68c63df506c44
Parents: a742693
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Jul 31 13:15:48 2014 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Jul 31 13:15:48 2014 +0300

----------------------------------------------------------------------
 ambari-agent/src/main/python/resource_management/core/logger.py  | 2 +-
 .../src/main/python/resource_management/core/providers/system.py | 4 ++--
 .../python/resource_management/libraries/functions/format.py     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/68b97f03/ambari-agent/src/main/python/resource_management/core/logger.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/logger.py b/ambari-agent/src/main/python/resource_management/core/logger.py
index da64f6a..e395bd7 100644
--- a/ambari-agent/src/main/python/resource_management/core/logger.py
+++ b/ambari-agent/src/main/python/resource_management/core/logger.py
@@ -89,4 +89,4 @@ class Logger:
     if arguments_str:  
       arguments_str = arguments_str[:-2]
     
-    return "{0} {{{1}}}".format(resource, arguments_str)
\ No newline at end of file
+    return unicode("{0} {{{1}}}").format(resource, arguments_str)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/68b97f03/ambari-agent/src/main/python/resource_management/core/providers/system.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/system.py b/ambari-agent/src/main/python/resource_management/core/providers/system.py
index 33b9ad9..e28e118 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/system.py
+++ b/ambari-agent/src/main/python/resource_management/core/providers/system.py
@@ -100,7 +100,7 @@ class FileProvider(Provider):
     elif self.resource.replace:
       if content is not None:
         with open(path, "rb") as fp:
-          old_content = fp.read()
+          old_content = fp.read().decode("UTF-8")
         if content != old_content:
           write = True
           reason = "contents don't match"
@@ -111,7 +111,7 @@ class FileProvider(Provider):
       Logger.info("Writing %s because %s" % (self.resource, reason))
       with open(path, "wb") as fp:
         if content:
-          fp.write(content)
+          fp.write(content.encode("UTF-8"))
 
     _ensure_metadata(self.resource.path, self.resource.owner,
                         self.resource.group, mode=self.resource.mode)

http://git-wip-us.apache.org/repos/asf/ambari/blob/68b97f03/ambari-agent/src/main/python/resource_management/libraries/functions/format.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/functions/format.py b/ambari-agent/src/main/python/resource_management/libraries/functions/format.py
index efbacd7..0dfc45d 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/functions/format.py
+++ b/ambari-agent/src/main/python/resource_management/libraries/functions/format.py
@@ -66,7 +66,7 @@ class ConfigurationFormatter(Formatter):
   
   def _convert_field(self, value, conversion, is_protected):
     if conversion == 'e':
-      return quote_bash_args(str(value))
+      return quote_bash_args(unicode(value))
     elif conversion == 'h':
       return "[PROTECTED]" if is_protected else value
     elif conversion == 'p':