[virt-tools-list] [virt-bootstrap] [PATCH 3/3] Show error when guestfs-python is not installed

Cedric Bosdonnat cbosdonnat at suse.com
Tue Nov 21 10:38:34 UTC 2017


On Wed, 2017-11-01 at 00:19 +0000, Radostin Stoyanov wrote:
> Show appropriate error message when the python bindings for
> libguestfs are not installed.
> ---
>  src/virtBootstrap/utils.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py
> index 2bd7873..f2c2d4f 100644
> --- a/src/virtBootstrap/utils.py
> +++ b/src/virtBootstrap/utils.py
> @@ -34,9 +34,14 @@ import tempfile
>  import logging
>  from distutils.spawn import find_executable
>  
> -import guestfs
>  import passlib.hosts
>  
> +try:
> +    import guestfs
> +except ImportError:
> +    raise RuntimeError('Python bindings for libguestfs are not installed')
> +
> +
>  # pylint: disable=invalid-name
>  # Create logger
>  logger = logging.getLogger(__name__)

ACK
--
Cedric




More information about the virt-tools-list mailing list