Manually fix issues that autopep8 introduced

* iam.py 161 -> 160 chars
* lamba -> single line function -> multiline function

Avoid redefining key

iam line length

iam.py now clean
pull/33695/head
John Barker 7 years ago committed by John R Barker
parent c57a7f05e1
commit 10cd2cd1b7

@ -559,8 +559,8 @@ def create_role(module, iam, name, path, role_list, prof_list, trust_policy_doc)
path=path).create_role_response.create_role_result.role path=path).create_role_response.create_role_result.role
if name not in prof_list: if name not in prof_list:
instance_profile_result = iam.create_instance_profile(name, instance_profile_result = iam.create_instance_profile(name, path=path) \
path=path).create_instance_profile_response.create_instance_profile_result.instance_profile .create_instance_profile_response.create_instance_profile_result.instance_profile
iam.add_role_to_instance_profile(name, name) iam.add_role_to_instance_profile(name, name)
else: else:
instance_profile_result = iam.get_instance_profile(name).get_instance_profile_response.get_instance_profile_result.instance_profile instance_profile_result = iam.get_instance_profile(name).get_instance_profile_response.get_instance_profile_result.instance_profile

@ -243,7 +243,8 @@ def main():
# Use v without a prefix to use with return values # Use v without a prefix to use with return values
v = DefineOid(dotprefix=False) v = DefineOid(dotprefix=False)
def Tree(): return defaultdict(Tree) def Tree():
return defaultdict(Tree)
results = Tree() results = Tree()

@ -223,7 +223,8 @@ def map_obj_to_commands(updates, module, warnings):
commands = list() commands = list()
want, have = updates want, have = updates
def needs_update(x): return want.get(x) is not None and (want.get(x) != have.get(x)) def needs_update(x):
return want.get(x) is not None and (want.get(x) != have.get(x))
def add(cmd): def add(cmd):
if 'management api http-commands' not in commands: if 'management api http-commands' not in commands:

@ -150,7 +150,8 @@ def map_obj_to_commands(want, have, module):
commands = list() commands = list()
state = module.params['state'] state = module.params['state']
def needs_update(x): return want.get(x) and (want.get(x) != have.get(x)) def needs_update(x):
return want.get(x) and (want.get(x) != have.get(x))
if state == 'absent': if state == 'absent':
if have['domain_name']: if have['domain_name']:

@ -174,9 +174,11 @@ def map_obj_to_commands(updates, module):
for update in updates: for update in updates:
want, have = update want, have = update
def needs_update(x): return want.get(x) and (want.get(x) != have.get(x)) def needs_update(x):
return want.get(x) and (want.get(x) != have.get(x))
def add(x): return commands.append('username %s %s' % (want['name'], x)) def add(x):
return commands.append('username %s %s' % (want['name'], x))
if want['state'] == 'absent': if want['state'] == 'absent':
commands.append('no username %s' % want['name']) commands.append('no username %s' % want['name'])

@ -150,7 +150,8 @@ def map_obj_to_commands(want, have, module):
commands = list() commands = list()
state = module.params['state'] state = module.params['state']
def needs_update(x): return want.get(x) is not None and (want.get(x) != have.get(x)) def needs_update(x):
return want.get(x) is not None and (want.get(x) != have.get(x))
if state == 'absent': if state == 'absent':
if have['hostname'] != 'Router': if have['hostname'] != 'Router':

@ -164,7 +164,8 @@ def check_args(module, warnings):
def map_obj_to_commands(want, have, module): def map_obj_to_commands(want, have, module):
commands = list() commands = list()
def needs_update(x): return want.get(x) is not None and (want.get(x) != have.get(x)) def needs_update(x):
return want.get(x) is not None and (want.get(x) != have.get(x))
if needs_update('state'): if needs_update('state'):
if want['state'] == 'absent': if want['state'] == 'absent':

@ -134,9 +134,11 @@ def map_obj_to_commands(want, have, module):
commands = list() commands = list()
state = module.params['state'] state = module.params['state']
def needs_update(x): return want.get(x) and (want.get(x) != have.get(x)) def needs_update(x):
return want.get(x) and (want.get(x) != have.get(x))
def difference(x, y, z): return [item for item in x[z] if item not in y[z]] def difference(x, y, z):
return [item for item in x[z] if item not in y[z]]
def remove(cmd, commands, vrf=None): def remove(cmd, commands, vrf=None):
if vrf: if vrf:

@ -175,11 +175,14 @@ def map_obj_to_commands(updates, module):
for update in updates: for update in updates:
want, have = update want, have = update
def needs_update(x): return want.get(x) and (want.get(x) != have.get(x)) def needs_update(x):
return want.get(x) and (want.get(x) != have.get(x))
def add(x): return commands.append('username %s %s' % (want['name'], x)) def add(x):
return commands.append('username %s %s' % (want['name'], x))
def remove(x): return commands.append('no username %s %s' % (want['name'], x)) def remove(x):
return commands.append('no username %s %s' % (want['name'], x))
if want['state'] == 'absent': if want['state'] == 'absent':
commands.append('no username %s' % want['name']) commands.append('no username %s' % want['name'])

@ -121,12 +121,14 @@ def select(predicate, iterable):
yield x yield x
def _identity(obj):
return obj
class GroupBy(object): class GroupBy(object):
# python 2, 3 generic grouping. # python 2, 3 generic grouping.
def __init__(self, iterable, key=None): def __init__(self, iterable, key=None):
if key is None: self.keyfunc = key if key else _identity
def key(x): return x
self.keyfunc = key
self.it = iter(iterable) self.it = iter(iterable)
self.tgtkey = self.currkey = self.currvalue = object() self.tgtkey = self.currkey = self.currvalue = object()

@ -2,7 +2,6 @@ lib/ansible/modules/cloud/amazon/aws_kms.py
lib/ansible/modules/cloud/amazon/ec2_elb.py lib/ansible/modules/cloud/amazon/ec2_elb.py
lib/ansible/modules/cloud/amazon/ecs_task.py lib/ansible/modules/cloud/amazon/ecs_task.py
lib/ansible/modules/cloud/amazon/elb_instance.py lib/ansible/modules/cloud/amazon/elb_instance.py
lib/ansible/modules/cloud/amazon/iam.py
lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py lib/ansible/modules/cloud/azure/azure_rm_networkinterface.py
lib/ansible/modules/cloud/centurylink/clc_loadbalancer.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_security_group_rule.py
@ -20,17 +19,9 @@ 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_logical_device.py
lib/ansible/modules/network/aos/aos_rack_type.py lib/ansible/modules/network/aos/aos_rack_type.py
lib/ansible/modules/network/aos/aos_template.py lib/ansible/modules/network/aos/aos_template.py
lib/ansible/modules/network/eos/eos_eapi.py
lib/ansible/modules/network/eos/eos_system.py
lib/ansible/modules/network/eos/eos_user.py
lib/ansible/modules/network/ios/ios_system.py
lib/ansible/modules/network/nxos/nxos_nxapi.py
lib/ansible/modules/network/nxos/nxos_system.py
lib/ansible/modules/network/nxos/nxos_user.py
lib/ansible/modules/network/ovs/openvswitch_bridge.py lib/ansible/modules/network/ovs/openvswitch_bridge.py
lib/ansible/modules/network/ovs/openvswitch_port.py lib/ansible/modules/network/ovs/openvswitch_port.py
lib/ansible/modules/network/sros/sros_rollback.py lib/ansible/modules/network/sros/sros_rollback.py
lib/ansible/modules/packaging/language/maven_artifact.py lib/ansible/modules/packaging/language/maven_artifact.py
lib/ansible/modules/packaging/os/homebrew_cask.py lib/ansible/modules/packaging/os/homebrew_cask.py
lib/ansible/modules/packaging/os/homebrew.py lib/ansible/modules/packaging/os/homebrew.py
lib/ansible/modules/storage/netapp/netapp_e_storagepool.py

Loading…
Cancel
Save