Ver código fonte

AMBARI-10522. Cannot install Ranger Admin on non-root + umask 027 (aonishuk)

Andrew Onishuk 10 anos atrás
pai
commit
e6a02eed7b

+ 2 - 2
ambari-common/src/main/python/resource_management/core/sudo.py

@@ -65,7 +65,7 @@ def rmtree(path):
   shell.checked_call(["rm","-rf", path], sudo=True)
   
 # fp.write replacement
-def create_file(filename, content, encoding='utf-8'):
+def create_file(filename, content, encoding=None):
   """
   if content is None, create empty file
   """
@@ -83,7 +83,7 @@ def create_file(filename, content, encoding='utf-8'):
   chmod(filename, 0644)
     
 # fp.read replacement
-def read_file(filename, encoding='utf-8'):
+def read_file(filename, encoding=None):
   tmpf = tempfile.NamedTemporaryFile()
   shell.checked_call(["cp", "-f", filename, tmpf.name], sudo=True)
   

+ 1 - 1
ambari-common/src/main/python/resource_management/libraries/providers/modify_properties_file.py

@@ -38,7 +38,7 @@ class ModifyPropertiesFileProvider(Provider):
     new_content_lines = []
     
     if sudo.path_isfile(filename):
-      file_content = sudo.read_file(filename)
+      file_content = sudo.read_file(filename, encoding=self.resource.encoding)
       new_content_lines += file_content.split('\n')
 
       Logger.info(format("Modifying existing properties file: {filename}"))