[virt-tools-list] [PATCH virtinst] Don't fail if no meter is used

Guido Günther agx at sigxcpu.org
Thu Oct 11 16:59:01 UTC 2012


like in the other modules
---
 virtinst/DistroInstaller.py |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/virtinst/DistroInstaller.py b/virtinst/DistroInstaller.py
index e559431..33efc31 100644
--- a/virtinst/DistroInstaller.py
+++ b/virtinst/DistroInstaller.py
@@ -125,8 +125,9 @@ def _upload_file(conn, meter, destpool, src):
 
         # Start transfer
         total = 0
-        meter.start(size=size,
-                    text=_("Transferring %s") % os.path.basename(src))
+        if meter:
+            meter.start(size=size,
+                        text=_("Transferring %s") % os.path.basename(src))
         while True:
             #blocksize = (1024 ** 2)
             blocksize = 1024
@@ -136,11 +137,13 @@ def _upload_file(conn, meter, destpool, src):
 
             safe_send(data)
             total += len(data)
-            meter.update(total)
+            if meter:
+                meter.update(total)
 
         # Cleanup
         stream.finish()
-        meter.end(size)
+        if meter:
+            meter.end(size)
     except:
         if vol:
             vol.delete(0)
-- 
1.7.10.4




More information about the virt-tools-list mailing list