From 1b6980b08647ad397613c5082c4e8a3f2594c7b8 Mon Sep 17 00:00:00 2001 From: Maciej Delmanowski Date: Sat, 18 Jul 2015 13:54:30 +0200 Subject: [PATCH] virt: remove BabyJSON Removed the usage of baby json. This is in response to the fact that the baby json functionality was removed in Ansible 1.8 Ref: #430 --- lib/ansible/modules/extras/cloud/misc/virt.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/misc/virt.py b/lib/ansible/modules/extras/cloud/misc/virt.py index 80b8e2558eb..b59c7ed3de3 100644 --- a/lib/ansible/modules/extras/cloud/misc/virt.py +++ b/lib/ansible/modules/extras/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)