mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Bulk autopep8 (modules)
As agreed in 2017-12-07 Core meeting bulk fix pep8 issues Generated using: autopep8 1.3.3 (pycodestyle: 2.3.1) autopep8 -r --max-line-length 160 --in-place --ignore E305,E402,E722,E741 lib/ansible/modules Manually fix issues that autopep8 has introduced
This commit is contained in:
parent
d13d7e9404
commit
c57a7f05e1
314 changed files with 3462 additions and 3383 deletions
|
@ -238,7 +238,7 @@ def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
|
|||
raise Exception(
|
||||
'Timed out waiting for async operation ' + msg + ' "' + str(
|
||||
promise['requestId']
|
||||
) + '" to complete.')
|
||||
) + '" to complete.')
|
||||
|
||||
|
||||
def _create_machine(module, profitbricks, datacenter, name):
|
||||
|
@ -290,7 +290,7 @@ def _create_machine(module, profitbricks, datacenter, name):
|
|||
|
||||
n = NIC(
|
||||
lan=int(lan)
|
||||
)
|
||||
)
|
||||
|
||||
s = Server(
|
||||
name=name,
|
||||
|
@ -299,7 +299,7 @@ def _create_machine(module, profitbricks, datacenter, name):
|
|||
cpu_family=cpu_family,
|
||||
create_volumes=[v],
|
||||
nics=[n],
|
||||
)
|
||||
)
|
||||
|
||||
try:
|
||||
create_server_response = profitbricks.create_server(
|
||||
|
@ -341,7 +341,7 @@ def _create_datacenter(module, profitbricks):
|
|||
i = Datacenter(
|
||||
name=datacenter,
|
||||
location=location
|
||||
)
|
||||
)
|
||||
|
||||
try:
|
||||
datacenter_response = profitbricks.create_datacenter(datacenter=i)
|
||||
|
@ -624,7 +624,7 @@ def main():
|
|||
if state == 'absent':
|
||||
if not module.params.get('datacenter'):
|
||||
module.fail_json(msg='datacenter parameter is required ' +
|
||||
'for running or stopping machines.')
|
||||
'for running or stopping machines.')
|
||||
|
||||
try:
|
||||
(changed) = remove_virtual_machine(module, profitbricks)
|
||||
|
@ -635,7 +635,7 @@ def main():
|
|||
elif state in ('running', 'stopped'):
|
||||
if not module.params.get('datacenter'):
|
||||
module.fail_json(msg='datacenter parameter is required for ' +
|
||||
'running or stopping machines.')
|
||||
'running or stopping machines.')
|
||||
try:
|
||||
(changed) = startstop_machine(module, profitbricks, state)
|
||||
module.exit_json(changed=changed)
|
||||
|
@ -649,10 +649,10 @@ def main():
|
|||
module.fail_json(msg='image parameter is required for new instance')
|
||||
if not module.params.get('subscription_user'):
|
||||
module.fail_json(msg='subscription_user parameter is ' +
|
||||
'required for new instance')
|
||||
'required for new instance')
|
||||
if not module.params.get('subscription_password'):
|
||||
module.fail_json(msg='subscription_password parameter is ' +
|
||||
'required for new instance')
|
||||
'required for new instance')
|
||||
|
||||
try:
|
||||
(machine_dict_array) = create_virtual_machine(module, profitbricks)
|
||||
|
|
|
@ -118,7 +118,8 @@ def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
|
|||
raise Exception(
|
||||
'Timed out waiting for async operation ' + msg + ' "' + str(
|
||||
promise['requestId']
|
||||
) + '" to complete.')
|
||||
) + '" to complete.')
|
||||
|
||||
|
||||
def _remove_datacenter(module, profitbricks, datacenter):
|
||||
try:
|
||||
|
@ -126,6 +127,7 @@ def _remove_datacenter(module, profitbricks, datacenter):
|
|||
except Exception as e:
|
||||
module.fail_json(msg="failed to remove the datacenter: %s" % str(e))
|
||||
|
||||
|
||||
def create_datacenter(module, profitbricks):
|
||||
"""
|
||||
Creates a Datacenter
|
||||
|
@ -148,7 +150,7 @@ def create_datacenter(module, profitbricks):
|
|||
name=name,
|
||||
location=location,
|
||||
description=description
|
||||
)
|
||||
)
|
||||
|
||||
try:
|
||||
datacenter_response = profitbricks.create_datacenter(datacenter=i)
|
||||
|
@ -166,6 +168,7 @@ def create_datacenter(module, profitbricks):
|
|||
except Exception as e:
|
||||
module.fail_json(msg="failed to create the new datacenter: %s" % str(e))
|
||||
|
||||
|
||||
def remove_datacenter(module, profitbricks):
|
||||
"""
|
||||
Removes a Datacenter.
|
||||
|
@ -197,6 +200,7 @@ def remove_datacenter(module, profitbricks):
|
|||
|
||||
return changed
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
|
|
|
@ -121,7 +121,8 @@ def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
|
|||
raise Exception(
|
||||
'Timed out waiting for async operation ' + msg + ' "' + str(
|
||||
promise['requestId']
|
||||
) + '" to complete.')
|
||||
) + '" to complete.')
|
||||
|
||||
|
||||
def create_nic(module, profitbricks):
|
||||
"""
|
||||
|
@ -173,6 +174,7 @@ def create_nic(module, profitbricks):
|
|||
except Exception as e:
|
||||
module.fail_json(msg="failed to create the NIC: %s" % str(e))
|
||||
|
||||
|
||||
def delete_nic(module, profitbricks):
|
||||
"""
|
||||
Removes a NIC
|
||||
|
@ -228,12 +230,13 @@ def delete_nic(module, profitbricks):
|
|||
except Exception as e:
|
||||
module.fail_json(msg="failed to remove the NIC: %s" % str(e))
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
datacenter=dict(),
|
||||
server=dict(),
|
||||
name=dict(default=str(uuid.uuid4()).replace('-','')[:10]),
|
||||
name=dict(default=str(uuid.uuid4()).replace('-', '')[:10]),
|
||||
lan=dict(),
|
||||
subscription_user=dict(),
|
||||
subscription_password=dict(no_log=True),
|
||||
|
@ -255,7 +258,6 @@ def main():
|
|||
if not module.params.get('server'):
|
||||
module.fail_json(msg='server parameter is required')
|
||||
|
||||
|
||||
subscription_user = module.params.get('subscription_user')
|
||||
subscription_password = module.params.get('subscription_password')
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
|
|||
raise Exception(
|
||||
'Timed out waiting for async operation ' + msg + ' "' + str(
|
||||
promise['requestId']
|
||||
) + '" to complete.')
|
||||
) + '" to complete.')
|
||||
|
||||
|
||||
def _create_volume(module, profitbricks, datacenter, name):
|
||||
|
@ -194,7 +194,7 @@ def _create_volume(module, profitbricks, datacenter, name):
|
|||
ssh_keys=ssh_keys,
|
||||
disk_type=disk_type,
|
||||
licence_type=licence_type
|
||||
)
|
||||
)
|
||||
|
||||
volume_response = profitbricks.create_volume(datacenter, v)
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ def _wait_for_completion(profitbricks, promise, wait_timeout, msg):
|
|||
raise Exception(
|
||||
'Timed out waiting for async operation ' + msg + ' "' + str(
|
||||
promise['requestId']
|
||||
) + '" to complete.')
|
||||
) + '" to complete.')
|
||||
|
||||
|
||||
def attach_volume(module, profitbricks):
|
||||
"""
|
||||
|
@ -150,7 +151,7 @@ def attach_volume(module, profitbricks):
|
|||
server_list = profitbricks.list_servers(datacenter)
|
||||
for s in server_list['items']:
|
||||
if server == s['properties']['name']:
|
||||
server= s['id']
|
||||
server = s['id']
|
||||
break
|
||||
|
||||
# Locate UUID for Volume
|
||||
|
@ -163,6 +164,7 @@ def attach_volume(module, profitbricks):
|
|||
|
||||
return profitbricks.attach_volume(datacenter, server, volume)
|
||||
|
||||
|
||||
def detach_volume(module, profitbricks):
|
||||
"""
|
||||
Detaches a volume.
|
||||
|
@ -193,7 +195,7 @@ def detach_volume(module, profitbricks):
|
|||
server_list = profitbricks.list_servers(datacenter)
|
||||
for s in server_list['items']:
|
||||
if server == s['properties']['name']:
|
||||
server= s['id']
|
||||
server = s['id']
|
||||
break
|
||||
|
||||
# Locate UUID for Volume
|
||||
|
@ -206,6 +208,7 @@ def detach_volume(module, profitbricks):
|
|||
|
||||
return profitbricks.detach_volume(datacenter, server, volume)
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue