E1 legacy pep8 fixes (#21933)

* E1 pep8 fixes

* e111 fix for rds.py
This commit is contained in:
Matt Martz 2017-03-21 21:19:40 -05:00 committed by GitHub
commit 02f66b9369
38 changed files with 865 additions and 888 deletions

View file

@ -825,7 +825,7 @@ def main():
if existing.get('asn'):
if (existing.get('asn') != module.params['asn'] and
state == 'present'):
state == 'present'):
module.fail_json(msg='Another BGP ASN already exists.',
proposed_asn=module.params['asn'],
existing_asn=existing.get('asn'))

View file

@ -704,7 +704,7 @@ def get_table_map_command(module, existing, key, value):
if value != 'default':
command = '{0} {1}'.format(key, module.params['table_map'])
if (module.params['table_map_filter'] is not None and
module.params['table_map_filter'] != 'default'):
module.params['table_map_filter'] != 'default'):
command += ' filter'
commands.append(command)
else:
@ -916,7 +916,7 @@ def main():
if existing.get('asn'):
if (existing.get('asn') != module.params['asn'] and
state == 'present'):
state == 'present'):
module.fail_json(msg='Another BGP ASN already exists.',
proposed_asn=module.params['asn'],
existing_asn=existing.get('asn'))

View file

@ -582,7 +582,7 @@ def main():
existing = invoke('get_existing', module, args)
if existing.get('asn'):
if (existing.get('asn') != module.params['asn'] and
state == 'present'):
state == 'present'):
module.fail_json(msg='Another BGP ASN already exists.',
proposed_asn=module.params['asn'],
existing_asn=existing.get('asn'))

View file

@ -415,7 +415,7 @@ def get_custom_value(arg, config, module):
value = ''
if (arg.startswith('filter_list') or arg.startswith('prefix_list') or
arg.startswith('route_map')):
arg.startswith('route_map')):
value = in_out_param(arg, splitted_config, module)
elif arg == 'send_community':
for line in splitted_config:
@ -874,9 +874,9 @@ def main():
state = module.params['state']
if ((module.params['max_prefix_interval'] or
module.params['max_prefix_warning'] or
module.params['max_prefix_threshold']) and
not module.params['max_prefix_limit']):
module.params['max_prefix_warning'] or
module.params['max_prefix_threshold']) and
not module.params['max_prefix_limit']):
module.fail_json(msg='max_prefix_limit is required when using '
'max_prefix_warning, max_prefix_limit or '
'max_prefix_threshold.')
@ -922,7 +922,7 @@ def main():
existing = invoke('get_existing', module, args)
if existing.get('asn'):
if (existing.get('asn') != module.params['asn'] and
state == 'present'):
state == 'present'):
module.fail_json(msg='Another BGP ASN already exists.',
proposed_asn=module.params['asn'],
existing_asn=existing.get('asn'))

View file

@ -317,9 +317,8 @@ def main():
if commands:
if (existing.get('route_distinguisher') and
proposed.get('route_distinguisher')):
if (existing['route_distinguisher'] != proposed[
'route_distinguisher'] and
proposed['route_distinguisher'] != 'default'):
if (existing['route_distinguisher'] != proposed['route_distinguisher'] and
proposed['route_distinguisher'] != 'default'):
WARNINGS.append('EVPN RD {0} was automatically removed. '
'It is highly recommended to use a task '
'(with default as value) to explicitly '

View file

@ -116,7 +116,7 @@ def get_available_features(feature, module):
available_features[feature] = state
else:
if (available_features[feature] == 'disabled' and
state == 'enabled'):
state == 'enabled'):
available_features[feature] = state
return available_features

View file

@ -222,11 +222,11 @@ def get_commands(module, state, mode):
elif module.params['system_mode_maintenance_timeout']:
timeout = get_maintenance_timeout(module)
if (state == 'present' and
timeout != module.params['system_mode_maintenance_timeout']):
timeout != module.params['system_mode_maintenance_timeout']):
commands.append('system mode maintenance timeout {0}'.format(
module.params['system_mode_maintenance_timeout']))
elif (state == 'absent' and
timeout == module.params['system_mode_maintenance_timeout']):
timeout == module.params['system_mode_maintenance_timeout']):
commands.append('no system mode maintenance timeout {0}'.format(
module.params['system_mode_maintenance_timeout']))
@ -236,9 +236,7 @@ def get_commands(module, state, mode):
elif module.params['system_mode_maintenance_on_reload_reset_reason']:
reset_reasons = get_reset_reasons(module)
if (state == 'present' and
module.params[
'system_mode_maintenance_on_reload_reset_reason'].lower() not
in reset_reasons.lower()):
module.params['system_mode_maintenance_on_reload_reset_reason'].lower() not in reset_reasons.lower()):
commands.append('system mode maintenance on-reload '
'reset-reason {0}'.format(
module.params[

View file

@ -343,7 +343,7 @@ def get_custom_command(existing_cmd, proposed, key, module):
elif key.startswith('ip ospf message-digest-key'):
if (proposed['message_digest_key_id'] != 'default' and
'options' not in key):
'options' not in key):
if proposed['message_digest_encryption_type'] == '3des':
encryption_type = '3'
elif proposed['message_digest_encryption_type'] == 'cisco_type_7':
@ -514,8 +514,8 @@ def main():
proposed['area'] = normalize_area(proposed['area'], module)
result = {}
if (state == 'present' or (state == 'absent' and
existing.get('ospf') == proposed['ospf'] and
existing.get('area') == proposed['area'])):
existing.get('ospf') == proposed['ospf'] and
existing.get('area') == proposed['area'])):
candidate = CustomNetworkConfig(indent=3)
invoke('state_%s' % state, module, existing, proposed, candidate)

View file

@ -456,7 +456,7 @@ def main():
result['updates'] = action_results
if (action == 'create' and
module.params['save_snapshot_locally']):
module.params['save_snapshot_locally']):
snapshot = get_snapshot(module)
written_file = write_on_file(snapshot,
module.params['snapshot_name'], module)

View file

@ -405,10 +405,9 @@ def main():
commands = ['no vlan ' + vlan_id]
elif state == 'present':
if (existing.get('mapped_vni') == '0' and
proposed.get('mapped_vni') == 'default'):
proposed.get('mapped_vni') == 'default'):
proposed.pop('mapped_vni')
delta = dict(set(
proposed.items()).difference(existing.items()))
delta = dict(set(proposed.items()).difference(existing.items()))
if delta or not existing:
commands = get_vlan_config_commands(delta, vlan_id)
@ -418,7 +417,7 @@ def main():
if commands:
if existing.get('mapped_vni') and state != 'absent':
if (existing.get('mapped_vni') != proposed.get('mapped_vni') and
existing.get('mapped_vni') != '0' and proposed.get('mapped_vni') != 'default'):
existing.get('mapped_vni') != '0' and proposed.get('mapped_vni') != 'default'):
commands.insert(1, 'no vn-segment')
if module.check_mode:
module.exit_json(changed=True,