Skip to content

Commit

Permalink
Port ovirt to python 3
Browse files Browse the repository at this point in the history
Since ovirt sdk is not running on python 2.4, we can use python 2.6
syntax directly for exceptions.
  • Loading branch information
mscherer authored and mattclay committed Dec 8, 2016
1 parent 715b88a commit 9f5f85c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/ansible/modules/extras/cloud/misc/ovirt.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,22 +461,22 @@ 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':
if get_vm(c, vmname) == "empty":
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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9f5f85c

Please sign in to comment.