]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fix corrupt repo detection
authorZack Cerza <zack@cerza.org>
Fri, 6 Jun 2014 17:01:33 +0000 (12:01 -0500)
committerZack Cerza <zack@cerza.org>
Fri, 6 Jun 2014 17:01:33 +0000 (12:01 -0500)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/worker.py

index 6676a9d2c97f5debeacb2a04665071744974ffaa..cdd76483cca7fa3bddb593d3e76abb9ba861950e 100644 (file)
@@ -91,10 +91,12 @@ def fetch_teuthology_branch(path, branch='master'):
     lock = filelock('%s.lock' % path)
     lock.acquire()
     try:
-        if os.path.isdir(path) and \
-                not os.path.isdir(os.path.join(path, '.git')):
-            log.info("Removing possibly-corrupt repo for branch %s", branch)
-            shutil.rmtree(path)
+        if os.path.isdir(path):
+            p = subprocess.Popen('git status', shell=True)
+            if p.wait() == 128:
+                log.info("Repo at %s appears corrupt; removing",
+                         branch)
+                shutil.rmtree(path)
 
         if not os.path.isdir(path):
             log.info("Cloning %s from upstream", branch)