Browse Source

AMBARI-11664. Unable to Install Hive Due To Invalid sudo Module Function (aonishuk)

Andrew Onishuk 10 years ago
parent
commit
7a75fb0a3e
1 changed files with 7 additions and 0 deletions
  1. 7 0
      ambari-common/src/main/python/resource_management/core/sudo.py

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

@@ -88,6 +88,9 @@ if os.geteuid() == 0:
   def path_lexists(path):
     return os.path.lexists(path)
   
+  def readlink(path):
+    return os.readlink(path)
+  
   def path_isfile(path):
     return os.path.isfile(path)
 
@@ -187,6 +190,10 @@ else:
   def path_lexists(path):
     return (shell.call(["test", "-L", path], sudo=True)[0] == 0)
   
+  # os.readlink
+  def readlink(path):
+    return shell.checked_call(["readlink", path], sudo=True)[1].strip()
+  
   # os.path.isfile
   def path_isfile(path):
     return (shell.call(["test", "-f", path], sudo=True)[0] == 0)