Wrap the Host object garbage collection out so that it gets run on
verify and repair tasks, as well as normal jobs.

Risk: Low
Visibility: Should avoid leaving host garbage behind after repair and
verify jobs.

Signed-off-by: John Admanski <jadmanski@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@3215 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/autoserv b/server/autoserv
index bd32cf8..9cc5aa5 100755
--- a/server/autoserv
+++ b/server/autoserv
@@ -118,18 +118,18 @@
     # run the job
     exit_code = 0
     try:
-        if repair:
-            job.repair(host_protection)
-        elif verify:
-            job.verify()
-        else:
-            try:
+        try:
+            if repair:
+                job.repair(host_protection)
+            elif verify:
+                job.verify()
+            else:
                 job.run(cleanup, install_before, install_after,
                         only_collect_crashinfo=collect_crashinfo)
-            finally:
-                while job.hosts:
-                    host = job.hosts.pop()
-                    host.close()
+        finally:
+            while job.hosts:
+                host = job.hosts.pop()
+                host.close()
     except:
         exit_code = 1
         traceback.print_exc()