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

Michal Privoznik mprivozn at redhat.com
Fri Oct 12 07:12:06 UTC 2012


On 11.10.2012 18:59, Guido Günther wrote:
> 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)
> 

ACK

Michal




More information about the virt-tools-list mailing list