Ver código 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/branches/branch-0.18@670102 13f79535-47bb-0310-9956-ffa450edef68
Nigel Daley 17 anos atrás
pai
commit
c30ab39678
2 arquivos 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

@@ -11,6 +11,8 @@ Release 0.18.0 - Unreleased
     HADOOP-3184. Modified HOD to handle master failures on bad nodes by trying 
     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)
     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
   NEW FEATURES
 
 

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

@@ -608,10 +608,11 @@ class hodRunner:
                          script + " : Not an executable.")
                          script + " : Not an executable.")
 
 
     if not os.path.exists(clusterDir):
     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):
     elif not os.path.isdir(clusterDir):
       errorFlag = True
       errorFlag = True
       errorMsgs.append( \
       errorMsgs.append( \