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:
parent
a2ff7fc7ea
commit
7d9fb08e1a
5 changed files with 24 additions and 26 deletions
|
@ -305,7 +305,7 @@ def _delete_disks_when_detached(azure, wait_timeout, disk_names):
|
||||||
if disk.attached_to is None:
|
if disk.attached_to is None:
|
||||||
azure.delete_disk(disk.name, True)
|
azure.delete_disk(disk.name, True)
|
||||||
disk_names.remove(disk_name)
|
disk_names.remove(disk_name)
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to get or delete disk, error was: %s" % (disk_name, str(e)))
|
module.fail_json(msg="failed to get or delete disk, error was: %s" % (disk_name, str(e)))
|
||||||
finally:
|
finally:
|
||||||
signal.alarm(0)
|
signal.alarm(0)
|
||||||
|
@ -363,7 +363,7 @@ def create_virtual_machine(module, azure):
|
||||||
result = azure.create_hosted_service(service_name=name, label=name, location=location)
|
result = azure.create_hosted_service(service_name=name, label=name, location=location)
|
||||||
_wait_for_completion(azure, result, wait_timeout, "create_hosted_service")
|
_wait_for_completion(azure, result, wait_timeout, "create_hosted_service")
|
||||||
changed = True
|
changed = True
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to create the new service, error was: %s" % str(e))
|
module.fail_json(msg="failed to create the new service, error was: %s" % str(e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -434,13 +434,13 @@ def create_virtual_machine(module, azure):
|
||||||
virtual_network_name=virtual_network_name)
|
virtual_network_name=virtual_network_name)
|
||||||
_wait_for_completion(azure, result, wait_timeout, "create_virtual_machine_deployment")
|
_wait_for_completion(azure, result, wait_timeout, "create_virtual_machine_deployment")
|
||||||
changed = True
|
changed = True
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to create the new virtual machine, error was: %s" % str(e))
|
module.fail_json(msg="failed to create the new virtual machine, error was: %s" % str(e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
deployment = azure.get_deployment_by_name(service_name=name, deployment_name=name)
|
deployment = azure.get_deployment_by_name(service_name=name, deployment_name=name)
|
||||||
return (changed, urlparse(deployment.url).hostname, deployment)
|
return (changed, urlparse(deployment.url).hostname, deployment)
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to lookup the deployment information for %s, error was: %s" % (name, str(e)))
|
module.fail_json(msg="failed to lookup the deployment information for %s, error was: %s" % (name, str(e)))
|
||||||
|
|
||||||
|
|
||||||
|
@ -468,9 +468,9 @@ def terminate_virtual_machine(module, azure):
|
||||||
disk_names = []
|
disk_names = []
|
||||||
try:
|
try:
|
||||||
deployment = azure.get_deployment_by_name(service_name=name, deployment_name=name)
|
deployment = azure.get_deployment_by_name(service_name=name, deployment_name=name)
|
||||||
except AzureMissingException, e:
|
except AzureMissingException as e:
|
||||||
pass # no such deployment or service
|
pass # no such deployment or service
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to find the deployment, error was: %s" % str(e))
|
module.fail_json(msg="failed to find the deployment, error was: %s" % str(e))
|
||||||
|
|
||||||
# Delete deployment
|
# Delete deployment
|
||||||
|
@ -483,13 +483,13 @@ def terminate_virtual_machine(module, azure):
|
||||||
role_props = azure.get_role(name, deployment.name, role.role_name)
|
role_props = azure.get_role(name, deployment.name, role.role_name)
|
||||||
if role_props.os_virtual_hard_disk.disk_name not in disk_names:
|
if role_props.os_virtual_hard_disk.disk_name not in disk_names:
|
||||||
disk_names.append(role_props.os_virtual_hard_disk.disk_name)
|
disk_names.append(role_props.os_virtual_hard_disk.disk_name)
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to get the role %s, error was: %s" % (role.role_name, str(e)))
|
module.fail_json(msg="failed to get the role %s, error was: %s" % (role.role_name, str(e)))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
result = azure.delete_deployment(name, deployment.name)
|
result = azure.delete_deployment(name, deployment.name)
|
||||||
_wait_for_completion(azure, result, wait_timeout, "delete_deployment")
|
_wait_for_completion(azure, result, wait_timeout, "delete_deployment")
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to delete the deployment %s, error was: %s" % (deployment.name, str(e)))
|
module.fail_json(msg="failed to delete the deployment %s, error was: %s" % (deployment.name, str(e)))
|
||||||
|
|
||||||
# It's unclear when disks associated with terminated deployment get detatched.
|
# It's unclear when disks associated with terminated deployment get detatched.
|
||||||
|
@ -497,14 +497,14 @@ def terminate_virtual_machine(module, azure):
|
||||||
# become detatched by polling the list of remaining disks and examining the state.
|
# become detatched by polling the list of remaining disks and examining the state.
|
||||||
try:
|
try:
|
||||||
_delete_disks_when_detached(azure, wait_timeout, disk_names)
|
_delete_disks_when_detached(azure, wait_timeout, disk_names)
|
||||||
except (AzureException, TimeoutError), e:
|
except (AzureException, TimeoutError) as e:
|
||||||
module.fail_json(msg=str(e))
|
module.fail_json(msg=str(e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Now that the vm is deleted, remove the cloud service
|
# Now that the vm is deleted, remove the cloud service
|
||||||
result = azure.delete_hosted_service(service_name=name)
|
result = azure.delete_hosted_service(service_name=name)
|
||||||
_wait_for_completion(azure, result, wait_timeout, "delete_hosted_service")
|
_wait_for_completion(azure, result, wait_timeout, "delete_hosted_service")
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
module.fail_json(msg="failed to delete the service %s, error was: %s" % (name, str(e)))
|
module.fail_json(msg="failed to delete the service %s, error was: %s" % (name, str(e)))
|
||||||
public_dns_name = urlparse(deployment.url).hostname
|
public_dns_name = urlparse(deployment.url).hostname
|
||||||
|
|
||||||
|
@ -613,7 +613,7 @@ class Wrapper(object):
|
||||||
while wait_timeout > time.time():
|
while wait_timeout > time.time():
|
||||||
try:
|
try:
|
||||||
return f()
|
return f()
|
||||||
except AzureException, e:
|
except AzureException as e:
|
||||||
if not str(e).lower().find("temporary redirect") == -1:
|
if not str(e).lower().find("temporary redirect") == -1:
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -241,7 +241,7 @@ class AzureRMStorageAccount(AzureRMModuleBase):
|
||||||
self.log('Checking name availability for {0}'.format(self.name))
|
self.log('Checking name availability for {0}'.format(self.name))
|
||||||
try:
|
try:
|
||||||
response = self.storage_client.storage_accounts.check_name_availability(self.name)
|
response = self.storage_client.storage_accounts.check_name_availability(self.name)
|
||||||
except AzureHttpError, e:
|
except AzureHttpError as e:
|
||||||
self.log('Error attempting to validate name.')
|
self.log('Error attempting to validate name.')
|
||||||
self.fail("Error checking name availability: {0}".format(str(e)))
|
self.fail("Error checking name availability: {0}".format(str(e)))
|
||||||
if not response.name_available:
|
if not response.name_available:
|
||||||
|
@ -384,7 +384,7 @@ class AzureRMStorageAccount(AzureRMModuleBase):
|
||||||
try:
|
try:
|
||||||
poller = self.storage_client.storage_accounts.create(self.resource_group, self.name, parameters)
|
poller = self.storage_client.storage_accounts.create(self.resource_group, self.name, parameters)
|
||||||
self.get_poller_result(poller)
|
self.get_poller_result(poller)
|
||||||
except AzureHttpError, e:
|
except AzureHttpError as e:
|
||||||
self.log('Error creating storage account.')
|
self.log('Error creating storage account.')
|
||||||
self.fail("Failed to create account: {0}".format(str(e)))
|
self.fail("Failed to create account: {0}".format(str(e)))
|
||||||
# the poller doesn't actually return anything
|
# the poller doesn't actually return anything
|
||||||
|
@ -402,7 +402,7 @@ class AzureRMStorageAccount(AzureRMModuleBase):
|
||||||
status = self.storage_client.storage_accounts.delete(self.resource_group, self.name)
|
status = self.storage_client.storage_accounts.delete(self.resource_group, self.name)
|
||||||
self.log("delete status: ")
|
self.log("delete status: ")
|
||||||
self.log(str(status))
|
self.log(str(status))
|
||||||
except AzureHttpError, e:
|
except AzureHttpError as e:
|
||||||
self.fail("Failed to delete the account: {0}".format(str(e)))
|
self.fail("Failed to delete the account: {0}".format(str(e)))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -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))
|
api.linode_update(LinodeId=linode_id, Label='%s_%s' % (linode_id, name))
|
||||||
# Save server
|
# Save server
|
||||||
servers = api.linode_list(LinodeId=linode_id)
|
servers = api.linode_list(LinodeId=linode_id)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||||
|
|
||||||
if not disks:
|
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),
|
Label='%s swap disk (lid: %s)' % (name, linode_id),
|
||||||
Size=swap)
|
Size=swap)
|
||||||
jobs.append(res['JobID'])
|
jobs.append(res['JobID'])
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
# TODO: destroy linode ?
|
# TODO: destroy linode ?
|
||||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
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,
|
api.linode_config_create(LinodeId=linode_id, KernelId=kernel_id,
|
||||||
Disklist=disks_list, Label='%s config' % name)
|
Disklist=disks_list, Label='%s config' % name)
|
||||||
configs = api.linode_config_list(LinodeId=linode_id)
|
configs = api.linode_config_list(LinodeId=linode_id)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||||
|
|
||||||
# Start / Ensure servers are running
|
# Start / Ensure servers are running
|
||||||
|
@ -395,7 +395,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||||
if server['STATUS'] != 2:
|
if server['STATUS'] != 2:
|
||||||
try:
|
try:
|
||||||
res = api.linode_shutdown(LinodeId=linode_id)
|
res = api.linode_shutdown(LinodeId=linode_id)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||||
instance['status'] = 'Stopping'
|
instance['status'] = 'Stopping'
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -415,7 +415,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||||
instance = getInstanceDetails(api, server)
|
instance = getInstanceDetails(api, server)
|
||||||
try:
|
try:
|
||||||
res = api.linode_reboot(LinodeId=server['LINODEID'])
|
res = api.linode_reboot(LinodeId=server['LINODEID'])
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||||
instance['status'] = 'Restarting'
|
instance['status'] = 'Restarting'
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -426,7 +426,7 @@ def linodeServers(module, api, state, name, plan, distribution, datacenter, lino
|
||||||
instance = getInstanceDetails(api, server)
|
instance = getInstanceDetails(api, server)
|
||||||
try:
|
try:
|
||||||
api.linode_delete(LinodeId=server['LINODEID'], skipChecks=True)
|
api.linode_delete(LinodeId=server['LINODEID'], skipChecks=True)
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||||
instance['status'] = 'Deleting'
|
instance['status'] = 'Deleting'
|
||||||
changed = True
|
changed = True
|
||||||
|
@ -481,14 +481,14 @@ def main():
|
||||||
if not api_key:
|
if not api_key:
|
||||||
try:
|
try:
|
||||||
api_key = os.environ['LINODE_API_KEY']
|
api_key = os.environ['LINODE_API_KEY']
|
||||||
except KeyError, e:
|
except KeyError as e:
|
||||||
module.fail_json(msg = 'Unable to load %s' % e.message)
|
module.fail_json(msg = 'Unable to load %s' % e.message)
|
||||||
|
|
||||||
# setup the auth
|
# setup the auth
|
||||||
try:
|
try:
|
||||||
api = linode_api.Api(api_key)
|
api = linode_api.Api(api_key)
|
||||||
api.test_echo()
|
api.test_echo()
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
module.fail_json(msg = '%s' % e.value[0]['ERRORMESSAGE'])
|
||||||
|
|
||||||
linodeServers(module, api, state, name, plan, distribution, datacenter, linode_id,
|
linodeServers(module, api, state, name, plan, distribution, datacenter, linode_id,
|
||||||
|
|
|
@ -77,7 +77,7 @@ author:
|
||||||
- "Trond Hindenes (@trondhindenes)"
|
- "Trond Hindenes (@trondhindenes)"
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
# This installs IIS.
|
# This installs IIS.
|
||||||
# The names of features available for install can be run by running the following Powershell Command:
|
# The names of features available for install can be run by running the following Powershell Command:
|
||||||
# PS C:\Users\Administrator> Import-Module ServerManager; Get-WindowsFeature
|
# PS C:\Users\Administrator> Import-Module ServerManager; Get-WindowsFeature
|
||||||
|
@ -99,6 +99,4 @@ ansible -m "win_feature" -a "name=NET-Framework-Core source=C:/Temp/iso/sources/
|
||||||
restart: yes
|
restart: yes
|
||||||
include_sub_features: yes
|
include_sub_features: yes
|
||||||
include_management_tools: yes
|
include_management_tools: yes
|
||||||
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -84,7 +84,7 @@ options:
|
||||||
required: false
|
required: false
|
||||||
'''
|
'''
|
||||||
|
|
||||||
EXAMPLES = '''
|
EXAMPLES = r'''
|
||||||
# Downloading a JPEG and saving it to a file with the ansible command.
|
# Downloading a JPEG and saving it to a file with the ansible command.
|
||||||
# Note the "dest" is quoted rather instead of escaping the backslashes
|
# Note the "dest" is quoted rather instead of escaping the backslashes
|
||||||
$ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthrise.jpg dest='C:\Users\Administrator\earthrise.jpg'" all
|
$ ansible -i hosts -c winrm -m win_get_url -a "url=http://www.example.com/earthrise.jpg dest='C:\Users\Administrator\earthrise.jpg'" all
|
||||||
|
|
Loading…
Reference in a new issue