From 9f5f85c9f07e55a179aa141153d6edd57dfe1541 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sat, 15 Oct 2016 17:11:01 +0200 Subject: [PATCH] Port ovirt to python 3 Since ovirt sdk is not running on python 2.4, we can use python 2.6 syntax directly for exceptions. --- lib/ansible/modules/extras/cloud/misc/ovirt.py | 6 +++--- .../extras/test/utils/shippable/sanity-skip-python3.txt | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/extras/cloud/misc/ovirt.py b/lib/ansible/modules/extras/cloud/misc/ovirt.py index f4f77ca8ce8..646d3cb3b66 100644 --- a/lib/ansible/modules/extras/cloud/misc/ovirt.py +++ b/lib/ansible/modules/extras/cloud/misc/ovirt.py @@ -461,7 +461,7 @@ def main(): #initialize connection try: c = conn(url+"/api", user, password) - except Exception, e: + except Exception as e: module.fail_json(msg='%s' % e) if state == 'present': @@ -469,14 +469,14 @@ def main(): if resource_type == 'template': try: create_vm_template(c, vmname, image, zone) - except Exception, e: + except Exception as e: module.fail_json(msg='%s' % e) module.exit_json(changed=True, msg="deployed VM %s from template %s" % (vmname,image)) elif resource_type == 'new': # FIXME: refactor, use keyword args. try: create_vm(c, vmtype, vmname, zone, vmdisk_size, vmcpus, vmnic, vmnetwork, vmmem, vmdisk_alloc, sdomain, vmcores, vmos, vmdisk_int) - except Exception, e: + except Exception as e: module.fail_json(msg='%s' % e) module.exit_json(changed=True, msg="deployed VM %s from scratch" % vmname) else: diff --git a/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt b/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt index 4c0ff360429..f5a2c57b676 100644 --- a/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt +++ b/lib/ansible/modules/extras/test/utils/shippable/sanity-skip-python3.txt @@ -33,7 +33,6 @@ /cloud/centurylink/clc_publicip.py /cloud/google/gce_img.py /cloud/google/gce_tag.py -/cloud/misc/ovirt.py /cloud/misc/proxmox.py /cloud/misc/proxmox_template.py /cloud/misc/virt_net.py