diff options
author | Brian Coca <bcoca@ansible.com> | 2015-07-18 16:32:42 -0400 |
---|---|---|
committer | Brian Coca <bcoca@ansible.com> | 2015-07-18 16:32:42 -0400 |
commit | 40b85c84318eeb9ef21301f6457274b132aa45e3 (patch) | |
tree | 74a8f105461d1a03b38a8a39f315c2087068a650 | |
parent | 5e7833d2b34435b7fbfc2e29b1197c7b160bb887 (diff) | |
parent | ebb91255670c4e02aadc3defcea6a09fd85b8726 (diff) | |
download | ansible-modules-extras-40b85c84318eeb9ef21301f6457274b132aa45e3.tar.gz |
Merge pull request #724 from drybjed/virt-babyjson
virt: remove BabyJSON
-rw-r--r-- | cloud/misc/virt.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cloud/misc/virt.py b/cloud/misc/virt.py index 80b8e255..b59c7ed3 100644 --- a/cloud/misc/virt.py +++ b/cloud/misc/virt.py @@ -93,8 +93,9 @@ import sys try: import libvirt except ImportError: - print "failed=True msg='libvirt python module unavailable'" - sys.exit(1) + HAS_VIRT = False +else: + HAS_VIRT = True ALL_COMMANDS = [] VM_COMMANDS = ['create','status', 'start', 'stop', 'pause', 'unpause', @@ -481,6 +482,11 @@ def main(): xml = dict(), )) + if not HAS_VIRT: + module.fail_json( + msg='The `libvirt` module is not importable. Check the requirements.' + ) + rc = VIRT_SUCCESS try: rc, result = core(module) |