mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Py3 exclude list (#3698)
* Fix a few modules to pass syntax checks under python3 * Move from a whitelist of modules to check for python3 compat to a blacklist
This commit is contained in:
committed by
Matt Clay
parent
a2ff7fc7ea
commit
7d9fb08e1a
@@ -259,7 +259,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||
api.linode_update(LinodeId=linode_id, Label='%s_%s' % (linode_id, name))
|
||||
# Save server
|
||||
servers = api.linode_list(LinodeId=linode_id)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
|
||||
if not disks:
|
||||
@@ -291,7 +291,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||
Label='%s swap disk (lid: %s)' % (name, linode_id),
|
||||
Size=swap)
|
||||
jobs.append(res['JobID'])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
# TODO: destroy linode ?
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
|
||||
@@ -334,7 +334,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||
api.linode_config_create(LinodeId=linode_id, KernelId=kernel_id,
|
||||
Disklist=disks_list, Label='%s config' % name)
|
||||
configs = api.linode_config_list(LinodeId=linode_id)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
|
||||
# Start / Ensure servers are running
|
||||
@@ -395,7 +395,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||
if server['STATUS'] != 2:
|
||||
try:
|
||||
res = api.linode_shutdown(LinodeId=linode_id)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
instance['status'] = 'Stopping'
|
||||
changed = True
|
||||
@@ -415,7 +415,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||
instance = getInstanceDetails(api, server)
|
||||
try:
|
||||
res = api.linode_reboot(LinodeId=server['LINODEID'])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
instance['status'] = 'Restarting'
|
||||
changed = True
|
||||
@@ -426,7 +426,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||
instance = getInstanceDetails(api, server)
|
||||
try:
|
||||
api.linode_delete(LinodeId=server['LINODEID'], skipChecks=True)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
instance['status'] = 'Deleting'
|
||||
changed = True
|
||||
@@ -481,14 +481,14 @@ def main():
|
||||
if not api_key:
|
||||
try:
|
||||
api_key = os.environ['LINODE_API_KEY']
|
||||
except KeyError, e:
|
||||
except KeyError as e:
|
||||
module.fail_json(msg = 'Unable to load %s' % e.message)
|
||||
|
||||
# setup the auth
|
||||
try:
|
||||
api = linode_api.Api(api_key)
|
||||
api.test_echo()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||
|
||||
linodeServers(module, api, state, name, plan, distribution, datacenter, linode_id,
|
||||
|
||||
Reference in New Issue
Block a user