Browse Source

AMBARI-8557 - Python EXE path seems to be hardcoded in ambari-env.cmd (Eugene Chekanskiy via abaranchuk)

Artem Baranchuk 10 years ago
parent
commit
e643e40b06
1 changed files with 9 additions and 0 deletions
  1. 9 0
      ambari-common/src/main/python/ambari_commons/os_utils.py

+ 9 - 0
ambari-common/src/main/python/ambari_commons/os_utils.py

@@ -20,6 +20,7 @@ limitations under the License.
 
 import shutil
 import string
+import os
 
 from os_check import *
 
@@ -100,3 +101,11 @@ def set_open_files_limit(maxOpenFiles):
 
 def get_password(prompt):
   return os_getpass(prompt)
+
+def find_in_path(file):
+  dirs = os.environ["PATH"].split(os.pathsep)
+  for dir in dirs:
+    full_path = os.path.join(dir, file)
+    if os.path.exists(full_path):
+      return full_path
+  raise Exception("File {} not found in PATH".format(file))