PHOENIX-2515 Fix error if Hadoop not installed

Don't log an error in bin scripts when looking for the
Hadoop classpath if Hadoop isn't installed.


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

Branch: refs/heads/4.x-HBase-1.0
Commit: be0ccb4c0de9fc3bde18afce3f06f1f6eb664057
Parents: f157906
Author: Gabriel Reid <[email protected]>
Authored: Fri Dec 11 13:50:47 2015 +0100
Committer: Gabriel Reid <[email protected]>
Committed: Sun Dec 13 07:05:19 2015 +0100

----------------------------------------------------------------------
 bin/phoenix_utils.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/be0ccb4c/bin/phoenix_utils.py
----------------------------------------------------------------------
diff --git a/bin/phoenix_utils.py b/bin/phoenix_utils.py
index 5fb4f08..6b00d5f 100755
--- a/bin/phoenix_utils.py
+++ b/bin/phoenix_utils.py
@@ -53,15 +53,18 @@ def findFileInPathWithoutRecursion(pattern, path):
 
     return ""
 
-def which(file):
+def which(command):
     for path in os.environ["PATH"].split(os.pathsep):
-        if os.path.exists(os.path.join(path, file)):
-            return os.path.join(path, file)
+        if os.path.exists(os.path.join(path, command)):
+            return os.path.join(path, command)
     return None
 
-def findClasspath(file):
-    aPath = which(file)
-    command = "%s%s" %(aPath, ' classpath')
+def findClasspath(command_name):
+    command_path = which(command_name)
+    if command_path is None:
+        # We don't have this command, so we can't get its classpath
+        return ''
+    command = "%s%s" %(command_path, ' classpath')
     return subprocess.Popen(command, shell=True, 
stdout=subprocess.PIPE).stdout.read()
 
 def setPath():

Reply via email to