Ver Fonte

HADOOP-3610. Modified HOD to create cluster directory if one does not exist when using the script option. Contributed by Vinod Kumar Vavilapalli.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@669986 13f79535-47bb-0310-9956-ffa450edef68
Hemanth Yamijala há 17 anos atrás
pai
commit
7b7f3feadd
2 ficheiros alterados com 7 adições e 4 exclusões
  1. 2 0
      src/contrib/hod/CHANGES.txt
  2. 5 4
      src/contrib/hod/hodlib/Hod/hod.py

+ 2 - 0
src/contrib/hod/CHANGES.txt

@@ -23,6 +23,8 @@ Release 0.18.0 - Unreleased
     HADOOP-3184. Modified HOD to handle master failures on bad nodes by trying 
     to bring them up on another node in the ring. (Hemanth Yamijala via ddas)
 
+    HADOOP-3610. Modified HOD to create cluster directory if one does not
+    exist when using the script option. (Vinod Kumar Vavilapalli via yhemanth)
 
   NEW FEATURES
 

+ 5 - 4
src/contrib/hod/hodlib/Hod/hod.py

@@ -608,10 +608,11 @@ class hodRunner:
                          script + " : Not an executable.")
 
     if not os.path.exists(clusterDir):
-      errorFlag = True
-      errorMsgs.append( \
-                  "Invalid cluster directory (--hod.clusterdir or -d) : " + \
-                  clusterDir + " : No such directory")
+      try:
+        os.makedirs(clusterDir)
+      except OSError, err:
+        errorFlag = True
+        errorMsgs.append("Could not create cluster directory. %s" % (str(err)))
     elif not os.path.isdir(clusterDir):
       errorFlag = True
       errorMsgs.append( \