properly close remote connections stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 16 Oct 2009 17:11:44 +0200
branchstable
changeset 3709 e67ade20bf80
parent 3708 95e8c3a9698a
child 3710 5bfdb591050a
properly close remote connections
cwctl.py
--- a/cwctl.py	Fri Oct 16 17:11:31 2009 +0200
+++ b/cwctl.py	Fri Oct 16 17:11:44 2009 +0200
@@ -774,13 +774,17 @@
             config.set_sources_mode(sources)
             config.repairing = self.config.force
             mih = config.migration_handler()
-        if args:
-            for arg in args:
-                mih.process_script(arg)
-        else:
-            mih.interactive_shell()
-        if not self.config.pyro:
-            mih.shutdown()
+        try:
+            if args:
+                for arg in args:
+                    mih.process_script(arg)
+            else:
+                mih.interactive_shell()
+        finally:
+            if not self.config.pyro:
+                mih.shutdown()
+            else:
+                cnx.close()
 
 
 class RecompileInstanceCatalogsCommand(InstanceCommand):