mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-08 09:24:01 -07:00
Fix remaining python3 compile problems
This commit is contained in:
parent
3901fe72d3
commit
ea05c56a41
19 changed files with 279 additions and 196 deletions
|
@ -117,7 +117,6 @@ VIRT_FAILED = 1
|
|||
VIRT_SUCCESS = 0
|
||||
VIRT_UNAVAILABLE=2
|
||||
|
||||
import sys
|
||||
|
||||
try:
|
||||
import libvirt
|
||||
|
@ -133,6 +132,9 @@ except ImportError:
|
|||
else:
|
||||
HAS_XML = True
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
ALL_COMMANDS = []
|
||||
ENTRY_COMMANDS = ['create', 'status', 'start', 'stop',
|
||||
'undefine', 'destroy', 'get_xml', 'define',
|
||||
|
@ -345,7 +347,7 @@ class LibvirtConnection(object):
|
|||
return self.conn.networkDefineXML(xml)
|
||||
else:
|
||||
try:
|
||||
state = self.find_entry(entryid)
|
||||
self.find_entry(entryid)
|
||||
except:
|
||||
return self.module.exit_json(changed=True)
|
||||
|
||||
|
@ -428,17 +430,17 @@ class VirtNetwork(object):
|
|||
|
||||
try:
|
||||
results[entry]["forward_mode"] = self.conn.get_forward(entry)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
try:
|
||||
results[entry]["domain"] = self.conn.get_domain(entry)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
try:
|
||||
results[entry]["macaddress"] = self.conn.get_macaddress(entry)
|
||||
except ValueError as e:
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
facts = dict()
|
||||
|
@ -532,7 +534,7 @@ def core(module):
|
|||
return VIRT_SUCCESS, res
|
||||
|
||||
else:
|
||||
module.fail_json(msg="Command %s not recognized" % basecmd)
|
||||
module.fail_json(msg="Command %s not recognized" % command)
|
||||
|
||||
if autostart is not None:
|
||||
if not name:
|
||||
|
@ -580,7 +582,7 @@ def main():
|
|||
rc = VIRT_SUCCESS
|
||||
try:
|
||||
rc, result = core(module)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg=str(e))
|
||||
|
||||
if rc != 0: # something went wrong emit the msg
|
||||
|
@ -589,6 +591,5 @@ def main():
|
|||
module.exit_json(**result)
|
||||
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
main()
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue