mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-05 13:44:24 -07:00
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.
This commit is contained in:
parent
715b88a8a5
commit
9f5f85c9f0
2 changed files with 3 additions and 4 deletions
|
@ -461,7 +461,7 @@ def main():
|
||||||
#initialize connection
|
#initialize connection
|
||||||
try:
|
try:
|
||||||
c = conn(url+"/api", user, password)
|
c = conn(url+"/api", user, password)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg='%s' % e)
|
module.fail_json(msg='%s' % e)
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
|
@ -469,14 +469,14 @@ def main():
|
||||||
if resource_type == 'template':
|
if resource_type == 'template':
|
||||||
try:
|
try:
|
||||||
create_vm_template(c, vmname, image, zone)
|
create_vm_template(c, vmname, image, zone)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg='%s' % e)
|
module.fail_json(msg='%s' % e)
|
||||||
module.exit_json(changed=True, msg="deployed VM %s from template %s" % (vmname,image))
|
module.exit_json(changed=True, msg="deployed VM %s from template %s" % (vmname,image))
|
||||||
elif resource_type == 'new':
|
elif resource_type == 'new':
|
||||||
# FIXME: refactor, use keyword args.
|
# FIXME: refactor, use keyword args.
|
||||||
try:
|
try:
|
||||||
create_vm(c, vmtype, vmname, zone, vmdisk_size, vmcpus, vmnic, vmnetwork, vmmem, vmdisk_alloc, sdomain, vmcores, vmos, vmdisk_int)
|
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.fail_json(msg='%s' % e)
|
||||||
module.exit_json(changed=True, msg="deployed VM %s from scratch" % vmname)
|
module.exit_json(changed=True, msg="deployed VM %s from scratch" % vmname)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
/cloud/centurylink/clc_publicip.py
|
/cloud/centurylink/clc_publicip.py
|
||||||
/cloud/google/gce_img.py
|
/cloud/google/gce_img.py
|
||||||
/cloud/google/gce_tag.py
|
/cloud/google/gce_tag.py
|
||||||
/cloud/misc/ovirt.py
|
|
||||||
/cloud/misc/proxmox.py
|
/cloud/misc/proxmox.py
|
||||||
/cloud/misc/proxmox_template.py
|
/cloud/misc/proxmox_template.py
|
||||||
/cloud/misc/virt_net.py
|
/cloud/misc/virt_net.py
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue