mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Bulk pep8 fixes - hand crafted (#33690)
* Bulk pep8 fixes - hand crafted Fix by hand the remaining issues that autopep8 couldn't * Next batch of hand crafted pep8 fixes * Ignore W503 https://github.com/PyCQA/pycodestyle/pull/499 * Revert more of W503
This commit is contained in:
parent
bcd189509e
commit
18529a275b
21 changed files with 57 additions and 87 deletions
|
@ -182,7 +182,7 @@ def do_grant(kms, keyarn, role_arn, granttypes, mode='grant', dry_run=True, clea
|
|||
statement['Principal']['AWS'] = valid_entries
|
||||
had_invalid_entries = True
|
||||
|
||||
if not role_arn in statement['Principal']['AWS']: # needs to be added.
|
||||
if role_arn not in statement['Principal']['AWS']: # needs to be added.
|
||||
changes_needed[granttype] = 'add'
|
||||
statement['Principal']['AWS'].append(role_arn)
|
||||
elif role_arn in statement['Principal']['AWS']: # not one the places the role should be
|
||||
|
@ -281,7 +281,7 @@ def main():
|
|||
# check the grant types for 'grant' only.
|
||||
if mode == 'grant':
|
||||
for g in module.params['grant_types']:
|
||||
if not g in statement_label:
|
||||
if g not in statement_label:
|
||||
module.fail_json(msg='{} is an unknown grant type.'.format(g))
|
||||
|
||||
ret = do_grant(kms, module.params['key_arn'], module.params['role_arn'], module.params['grant_types'],
|
||||
|
|
|
@ -249,23 +249,23 @@ def main():
|
|||
|
||||
# Validate Inputs
|
||||
if module.params['operation'] == 'run':
|
||||
if not 'task_definition' in module.params and module.params['task_definition'] is None:
|
||||
if 'task_definition' not in module.params and module.params['task_definition'] is None:
|
||||
module.fail_json(msg="To run a task, a task_definition must be specified")
|
||||
task_to_list = module.params['task_definition']
|
||||
status_type = "RUNNING"
|
||||
|
||||
if module.params['operation'] == 'start':
|
||||
if not 'task_definition' in module.params and module.params['task_definition'] is None:
|
||||
if 'task_definition' not in module.params and module.params['task_definition'] is None:
|
||||
module.fail_json(msg="To start a task, a task_definition must be specified")
|
||||
if not 'container_instances' in module.params and module.params['container_instances'] is None:
|
||||
if 'container_instances' not in module.params and module.params['container_instances'] is None:
|
||||
module.fail_json(msg="To start a task, container instances must be specified")
|
||||
task_to_list = module.params['task']
|
||||
status_type = "RUNNING"
|
||||
|
||||
if module.params['operation'] == 'stop':
|
||||
if not 'task' in module.params and module.params['task'] is None:
|
||||
if 'task' not in module.params and module.params['task'] is None:
|
||||
module.fail_json(msg="To stop a task, a task must be specified")
|
||||
if not 'task_definition' in module.params and module.params['task_definition'] is None:
|
||||
if 'task_definition' not in module.params and module.params['task_definition'] is None:
|
||||
module.fail_json(msg="To stop a task, a task definition must be specified")
|
||||
task_to_list = module.params['task_definition']
|
||||
status_type = "STOPPED"
|
||||
|
|
|
@ -796,7 +796,7 @@ class ClcLoadBalancer:
|
|||
for node in nodes_to_add:
|
||||
if not node.get('status'):
|
||||
node['status'] = 'enabled'
|
||||
if not node in nodes:
|
||||
if node not in nodes:
|
||||
changed = True
|
||||
nodes.append(node)
|
||||
if changed is True and not self.module.check_mode:
|
||||
|
|
|
@ -669,8 +669,7 @@ def _get_server_state(module, cloud):
|
|||
if server and state == 'present':
|
||||
if server.status not in ('ACTIVE', 'SHUTOFF', 'PAUSED', 'SUSPENDED'):
|
||||
module.fail_json(
|
||||
msg="The instance is available but not Active state: "
|
||||
+ server.status)
|
||||
msg="The instance is available but not Active state: " + server.status)
|
||||
(ip_changed, server) = _check_ips(module, cloud, server)
|
||||
(sg_changed, server) = _check_security_groups(module, cloud, server)
|
||||
(server_changed, server) = _update_server(module, cloud, server)
|
||||
|
|
|
@ -525,17 +525,14 @@ def find_datastore(module, s, datastore, config_target):
|
|||
ds = None
|
||||
if config_target:
|
||||
for d in config_target.Datastore:
|
||||
if (d.Datastore.Accessible and
|
||||
(datastore and d.Datastore.Name == datastore)
|
||||
or (not datastore)):
|
||||
if d.Datastore.Accessible and (datastore and d.Datastore.Name == datastore) or (not datastore):
|
||||
ds = d.Datastore.Datastore
|
||||
datastore = d.Datastore.Name
|
||||
break
|
||||
else:
|
||||
for ds_mor, ds_name in s.get_datastores().items():
|
||||
ds_props = VIProperty(s, ds_mor)
|
||||
if (ds_props.summary.accessible and (datastore and ds_name == datastore)
|
||||
or (not datastore)):
|
||||
if ds_props.summary.accessible and (datastore and ds_name == datastore) or (not datastore):
|
||||
ds = ds_mor
|
||||
datastore = ds_name
|
||||
if not ds:
|
||||
|
|
|
@ -676,7 +676,7 @@ def main():
|
|||
# Follow Keyword Controlled Behavior
|
||||
if state == 'present':
|
||||
# return the record if no value is specified
|
||||
if not "value" in new_record:
|
||||
if "value" not in new_record:
|
||||
if not current_record:
|
||||
module.fail_json(
|
||||
msg="A record with name '%s' does not exist for domain '%s.'" % (record_name, module.params['domain']))
|
||||
|
|
|
@ -356,7 +356,7 @@ def main():
|
|||
'address': ipv4_networks[ipv4_network]['address'],
|
||||
'netmask': ipv4_networks[ipv4_network]['netmask']
|
||||
}
|
||||
if not current_interface in interface_to_ipv4:
|
||||
if current_interface not in interface_to_ipv4:
|
||||
interface_to_ipv4[current_interface] = []
|
||||
interface_to_ipv4[current_interface].append(current_network)
|
||||
else:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
E305
|
||||
E402
|
||||
W503
|
||||
E722
|
||||
E741
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
lib/ansible/modules/cloud/amazon/aws_kms.py
|
||||
lib/ansible/modules/cloud/amazon/ec2_elb.py
|
||||
lib/ansible/modules/cloud/amazon/ecs_task.py
|
||||
lib/ansible/modules/cloud/amazon/elb_instance.py
|
||||
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py
|
||||
lib/ansible/modules/cloud/centurylink/clc_loadbalancer.py
|
||||
lib/ansible/modules/cloud/openstack/os_security_group_rule.py
|
||||
lib/ansible/modules/cloud/openstack/os_server.py
|
||||
lib/ansible/modules/cloud/rackspace/rax_files.py
|
||||
lib/ansible/modules/cloud/vmware/vsphere_guest.py
|
||||
lib/ansible/modules/database/mongodb/mongodb_user.py
|
||||
lib/ansible/modules/net_tools/dnsmadeeasy.py
|
||||
lib/ansible/modules/net_tools/snmp_facts.py
|
||||
lib/ansible/modules/network/aos/aos_blueprint.py
|
||||
lib/ansible/modules/network/aos/aos_device.py
|
||||
lib/ansible/modules/network/aos/aos_external_router.py
|
||||
lib/ansible/modules/network/aos/aos_ip_pool.py
|
||||
lib/ansible/modules/network/aos/aos_logical_device_map.py
|
||||
lib/ansible/modules/network/aos/aos_logical_device.py
|
||||
lib/ansible/modules/network/aos/aos_rack_type.py
|
||||
lib/ansible/modules/network/aos/aos_template.py
|
||||
lib/ansible/modules/network/ovs/openvswitch_bridge.py
|
||||
lib/ansible/modules/network/ovs/openvswitch_port.py
|
||||
lib/ansible/modules/network/sros/sros_rollback.py
|
||||
lib/ansible/modules/packaging/language/maven_artifact.py
|
||||
lib/ansible/modules/packaging/os/homebrew_cask.py
|
||||
lib/ansible/modules/packaging/os/homebrew.py
|
Loading…
Reference in a new issue