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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ea84ed3..20a59d2 100644
--- a/src/virtBootstrap/utils.py
+++ b/src/virtBootstrap/utils.py
@@ -33,9 +33,14 @@ import sys
 import tempfile
 import logging
 
-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__)
-- 
2.13.6

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux