mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00: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:
committed by
John R Barker
parent
d13d7e9404
commit
c57a7f05e1
@@ -158,10 +158,10 @@ def main():
|
||||
argument_spec = infinibox_argument_spec()
|
||||
argument_spec.update(
|
||||
dict(
|
||||
name = dict(required=True),
|
||||
state = dict(default='present', choices=['present', 'absent']),
|
||||
filesystem = dict(required=True),
|
||||
client_list = dict(type='list')
|
||||
name=dict(required=True),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
filesystem=dict(required=True),
|
||||
client_list=dict(type='list')
|
||||
)
|
||||
)
|
||||
|
||||
@@ -172,10 +172,10 @@ def main():
|
||||
if not HAS_MUNCH:
|
||||
module.fail_json(msg='the python munch library is required for this module')
|
||||
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
filesystem = get_filesystem(module, system)
|
||||
export = get_export(module, filesystem, system)
|
||||
export = get_export(module, filesystem, system)
|
||||
|
||||
if filesystem is None:
|
||||
module.fail_json(msg='Filesystem {} not found'.format(module.params['filesystem']))
|
||||
|
||||
@@ -116,11 +116,11 @@ def update_client(module, export):
|
||||
|
||||
changed = False
|
||||
|
||||
client = module.params['client']
|
||||
access_mode = module.params['access_mode']
|
||||
client = module.params['client']
|
||||
access_mode = module.params['access_mode']
|
||||
no_root_squash = module.params['no_root_squash']
|
||||
|
||||
client_list = export.get_permissions()
|
||||
client_list = export.get_permissions()
|
||||
client_not_in_list = True
|
||||
|
||||
for index, item in enumerate(client_list):
|
||||
@@ -154,7 +154,7 @@ def delete_client(module, export):
|
||||
|
||||
changed = False
|
||||
|
||||
client = module.params['client']
|
||||
client = module.params['client']
|
||||
client_list = export.get_permissions()
|
||||
|
||||
for index, item in enumerate(client_list):
|
||||
@@ -175,11 +175,11 @@ def main():
|
||||
argument_spec = infinibox_argument_spec()
|
||||
argument_spec.update(
|
||||
dict(
|
||||
client = dict(required=True),
|
||||
access_mode = dict(choices=['RO', 'RW'], default='RW'),
|
||||
no_root_squash = dict(type='bool', default='no'),
|
||||
state = dict(default='present', choices=['present', 'absent']),
|
||||
export = dict(required=True)
|
||||
client=dict(required=True),
|
||||
access_mode=dict(choices=['RO', 'RW'], default='RW'),
|
||||
no_root_squash=dict(type='bool', default='no'),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
export=dict(required=True)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -190,8 +190,8 @@ def main():
|
||||
if not HAS_MUNCH:
|
||||
module.fail_json(msg='the python munch library is required for this module')
|
||||
|
||||
system = get_system(module)
|
||||
export = get_export(module, system)
|
||||
system = get_system(module)
|
||||
export = get_export(module, system)
|
||||
|
||||
if module.params['state'] == 'present':
|
||||
update_client(module, export)
|
||||
|
||||
@@ -126,10 +126,10 @@ def main():
|
||||
argument_spec = infinibox_argument_spec()
|
||||
argument_spec.update(
|
||||
dict(
|
||||
name = dict(required=True),
|
||||
state = dict(default='present', choices=['present', 'absent']),
|
||||
pool = dict(required=True),
|
||||
size = dict()
|
||||
name=dict(required=True),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
pool=dict(required=True),
|
||||
size=dict()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -146,9 +146,9 @@ def main():
|
||||
except:
|
||||
module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units')
|
||||
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
pool = get_pool(module, system)
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
pool = get_pool(module, system)
|
||||
filesystem = get_filesystem(module, system)
|
||||
|
||||
if pool is None:
|
||||
|
||||
@@ -81,7 +81,7 @@ from ansible.module_utils.infinibox import HAS_INFINISDK, api_wrapper, get_syste
|
||||
@api_wrapper
|
||||
def get_host(module, system):
|
||||
|
||||
host = None
|
||||
host = None
|
||||
|
||||
for h in system.hosts.to_list():
|
||||
if h.get_name() == module.params['name']:
|
||||
@@ -124,10 +124,10 @@ def main():
|
||||
argument_spec = infinibox_argument_spec()
|
||||
argument_spec.update(
|
||||
dict(
|
||||
name = dict(required=True),
|
||||
state = dict(default='present', choices=['present', 'absent']),
|
||||
wwns = dict(type='list'),
|
||||
volume = dict()
|
||||
name=dict(required=True),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
wwns=dict(type='list'),
|
||||
volume=dict()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -136,9 +136,9 @@ def main():
|
||||
if not HAS_INFINISDK:
|
||||
module.fail_json(msg='infinisdk is required for this module')
|
||||
|
||||
state = module.params['state']
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
host = get_host(module, system)
|
||||
host = get_host(module, system)
|
||||
|
||||
if module.params['volume']:
|
||||
try:
|
||||
|
||||
@@ -102,9 +102,9 @@ def get_pool(module, system):
|
||||
@api_wrapper
|
||||
def create_pool(module, system):
|
||||
"""Create Pool"""
|
||||
name = module.params['name']
|
||||
size = module.params['size']
|
||||
vsize = module.params['vsize']
|
||||
name = module.params['name']
|
||||
size = module.params['size']
|
||||
vsize = module.params['vsize']
|
||||
ssd_cache = module.params['ssd_cache']
|
||||
|
||||
if not module.check_mode:
|
||||
@@ -126,10 +126,10 @@ def create_pool(module, system):
|
||||
@api_wrapper
|
||||
def update_pool(module, system, pool):
|
||||
"""Update Pool"""
|
||||
changed = False
|
||||
changed = False
|
||||
|
||||
size = module.params['size']
|
||||
vsize = module.params['vsize']
|
||||
size = module.params['size']
|
||||
vsize = module.params['vsize']
|
||||
ssd_cache = module.params['ssd_cache']
|
||||
|
||||
# Roundup the capacity to mimic Infinibox behaviour
|
||||
@@ -167,11 +167,11 @@ def main():
|
||||
argument_spec = infinibox_argument_spec()
|
||||
argument_spec.update(
|
||||
dict(
|
||||
name = dict(required=True),
|
||||
state = dict(default='present', choices=['present', 'absent']),
|
||||
size = dict(),
|
||||
vsize = dict(),
|
||||
ssd_cache = dict(type='bool', default=True)
|
||||
name=dict(required=True),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
size=dict(),
|
||||
vsize=dict(),
|
||||
ssd_cache=dict(type='bool', default=True)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -194,9 +194,9 @@ def main():
|
||||
except:
|
||||
module.fail_json(msg='vsize (Virtual Capacity) should be defined in MB, GB, TB or PB units')
|
||||
|
||||
state = module.params['state']
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
pool = get_pool(module, system)
|
||||
pool = get_pool(module, system)
|
||||
|
||||
if state == 'present' and not pool:
|
||||
create_pool(module, system)
|
||||
|
||||
@@ -126,10 +126,10 @@ def main():
|
||||
argument_spec = infinibox_argument_spec()
|
||||
argument_spec.update(
|
||||
dict(
|
||||
name = dict(required=True),
|
||||
state = dict(default='present', choices=['present', 'absent']),
|
||||
pool = dict(required=True),
|
||||
size = dict()
|
||||
name=dict(required=True),
|
||||
state=dict(default='present', choices=['present', 'absent']),
|
||||
pool=dict(required=True),
|
||||
size=dict()
|
||||
)
|
||||
)
|
||||
|
||||
@@ -144,9 +144,9 @@ def main():
|
||||
except:
|
||||
module.fail_json(msg='size (Physical Capacity) should be defined in MB, GB, TB or PB units')
|
||||
|
||||
state = module.params['state']
|
||||
state = module.params['state']
|
||||
system = get_system(module)
|
||||
pool = get_pool(module, system)
|
||||
pool = get_pool(module, system)
|
||||
volume = get_volume(module, system)
|
||||
|
||||
if pool is None:
|
||||
|
||||
@@ -129,7 +129,7 @@ class NetAppCDOTQTree(object):
|
||||
qtree_list_iter = netapp_utils.zapi.NaElement('qtree-list-iter')
|
||||
query_details = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
'qtree-info', **{'vserver': self.vserver,
|
||||
'volume':self.flexvol_name,
|
||||
'volume': self.flexvol_name,
|
||||
'qtree': self.name})
|
||||
|
||||
query = netapp_utils.zapi.NaElement('query')
|
||||
|
||||
@@ -246,7 +246,7 @@ class NetAppCDOTVolume(object):
|
||||
else:
|
||||
volume_delete = netapp_utils.zapi.NaElement.create_node_with_children(
|
||||
'volume-destroy', **{'name': self.name, 'unmount-and-offline':
|
||||
'true'})
|
||||
'true'})
|
||||
|
||||
try:
|
||||
self.server.invoke_successfully(volume_delete,
|
||||
|
||||
@@ -168,7 +168,7 @@ def create_async(module, ssid, api_url, api_pwd, api_usr, body):
|
||||
rc, data = request(url, data=post_data, method='POST', url_username=api_usr, url_password=api_pwd,
|
||||
headers=HEADERS)
|
||||
except Exception as e:
|
||||
module.exit_json(msg="Exception while creating aysnc mirror group. Message: %s" % to_native(e),
|
||||
module.exit_json(msg="Exception while creating aysnc mirror group. Message: %s" % to_native(e),
|
||||
exception=traceback.format_exc())
|
||||
return data
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ class GroupBy(object):
|
||||
# python 2, 3 generic grouping.
|
||||
def __init__(self, iterable, key=None):
|
||||
if key is None:
|
||||
key = lambda x: x
|
||||
def key(x): return x
|
||||
self.keyfunc = key
|
||||
self.it = iter(iterable)
|
||||
self.tgtkey = self.currkey = self.currvalue = object()
|
||||
|
||||
@@ -312,11 +312,11 @@ class SolidFireSnapShotSchedule(object):
|
||||
elif self.state == 'present':
|
||||
# Check if we need to update the account
|
||||
|
||||
if self.retention is not None and schedule_detail.schedule_info.retention !=self.retention:
|
||||
if self.retention is not None and schedule_detail.schedule_info.retention != self.retention:
|
||||
update_schedule = True
|
||||
changed = True
|
||||
|
||||
elif schedule_detail.name !=self.name:
|
||||
elif schedule_detail.name != self.name:
|
||||
update_schedule = True
|
||||
changed = True
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ class SolidFireVolumeAccessGroup(object):
|
||||
update_group = True
|
||||
changed = True
|
||||
elif self.virtual_network_id is not None or self.virtual_network_tags is not None or \
|
||||
self.attributes is not None:
|
||||
self.attributes is not None:
|
||||
update_group = True
|
||||
changed = True
|
||||
|
||||
|
||||
@@ -289,7 +289,7 @@ class SolidFireVolume(object):
|
||||
elif volume_detail.total_size is not None and volume_detail.total_size != self.size:
|
||||
size_difference = abs(float(volume_detail.total_size - self.size))
|
||||
# Change size only if difference is bigger than 0.001
|
||||
if size_difference/self.size > 0.001:
|
||||
if size_difference / self.size > 0.001:
|
||||
update_volume = True
|
||||
changed = True
|
||||
|
||||
@@ -312,8 +312,8 @@ class SolidFireVolume(object):
|
||||
self.create_volume()
|
||||
result_message = "Volume created"
|
||||
elif update_volume:
|
||||
self.update_volume()
|
||||
result_message = "Volume updated"
|
||||
self.update_volume()
|
||||
result_message = "Volume updated"
|
||||
|
||||
elif self.state == 'absent':
|
||||
self.delete_volume()
|
||||
|
||||
Reference in New Issue
Block a user