Clean up more linting errors for nxos modules (#62069)

This removes a few unused variables and duplicate functions being
defined.

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-09-11 09:35:09 -04:00 committed by GitHub
parent 7173267095
commit b7ab8f9411
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 1 additions and 34 deletions

View file

@ -152,11 +152,6 @@ class Telemetry(ConfigBase):
ref.get_playvals()
device_cache = ref.cache_existing
if device_cache is None:
device_cache_lines = []
else:
device_cache_lines = device_cache.split("\n")
# Get Telemetry Destination Group Data
if want.get('destination_groups'):
td = {'name': 'destination_groups', 'type': 'TMS_DESTGROUP',

View file

@ -45,7 +45,6 @@ class LacpFacts(object):
:rtype: dictionary
:returns: facts
"""
obj = []
if not data:
data = connection.get("show running-config | include lacp")
resources = data.strip()

View file

@ -76,11 +76,6 @@ class Default(FactsBase):
if match:
return match.group(1)
def parse_license_hostid(self, data):
match = re.search(r'License hostid: VDH=(.+)$', data, re.M)
if match:
return match.group(1)
def platform_facts(self):
platform_facts = {}

View file

@ -1116,8 +1116,6 @@ class NxosCmdRef:
# Multiple Instances:
if isinstance(existing, dict) and multiple:
item_found = False
for ekey, evalue in existing.items():
if isinstance(evalue, dict):
# Remove values set to string 'None' from dvalue

View file

@ -316,7 +316,7 @@ def is_default_interface(name, module):
try:
body = execute_show_command(command, module)[0]
except (IndexError, TypeError) as e:
except (IndexError, TypeError):
body = ''
if body:
@ -535,7 +535,6 @@ def map_config_to_obj(want, module):
obj['description'] = interface_table.get('desc')
obj['mtu'] = interface_table.get('eth_mtu')
obj['duplex'] = interface_table.get('eth_duplex')
speed = interface_table.get('eth_speed')
command = 'show run interface {0}'.format(obj['name'])
body = execute_show_command(command, module)[0]

View file

@ -338,11 +338,6 @@ def get_custom_value(arg, config, module):
splitted_config = config.splitlines()
value = ''
command_re = re.compile(r'\s+{0}\s*'.format(command), re.M)
has_command = command_re.search(config)
command_val_re = re.compile(r'(?:{0}\s)(?P<value>.*)$'.format(command), re.M)
has_command_val = command_val_re.search(config)
if arg.startswith('additional_paths'):
value = 'inherit'
for line in splitted_config:

View file

@ -188,7 +188,6 @@ def get_reset_reasons(module):
def get_commands(module, state, mode):
commands = list()
system_mode = ''
if module.params['system_mode_maintenance'] is True and mode == 'normal':
commands.append('system mode maintenance')
elif (module.params['system_mode_maintenance'] is False and

View file

@ -121,7 +121,6 @@ def main():
desired = get_desired(module)
state = module.params['state']
restart = module.params['restart']
commands = list()

View file

@ -289,7 +289,6 @@ def get_pim_interface(module, interface):
elif 'sparse-mode' in each:
pim_interface['sparse'] = True
elif 'bfd-instance' in each:
value = 'default'
m = re.search(r'ip pim bfd-instance(?P<disable> disable)?', each)
if m:
pim_interface['bfd'] = 'disable' if m.group('disable') else 'enable'
@ -509,7 +508,6 @@ def main():
jp_policy_out = module.params['jp_policy_out']
neighbor_policy = module.params['neighbor_policy']
neighbor_type = module.params['neighbor_type']
hello_interval = module.params['hello_interval']
intf_type = get_interface_type(interface)
if get_interface_mode(interface, intf_type, module) == 'layer2':

View file

@ -192,7 +192,6 @@ def main():
check_args(module, warnings)
destination = module.params['dest']
count = module.params['count']
state = module.params['state']
ping_command = 'ping {0}'.format(destination)

View file

@ -160,7 +160,6 @@ def validate_roles(value, module):
def map_obj_to_commands(updates, module):
commands = list()
state = module.params['state']
update_password = module.params['update_password']
for update in updates:

View file

@ -210,12 +210,9 @@ def main():
'configuring a VRF on an interface. You can '
'use nxos_interface')
proposed = dict(interface=interface, vrf=vrf)
current_vrf = get_interface_info(interface, module)
existing = dict(interface=interface, vrf=current_vrf)
changed = False
end_state = existing
if not existing['vrf']:
pass
@ -247,8 +244,6 @@ def main():
else:
load_config(module, commands)
changed = True
changed_vrf = get_interface_info(interface, module)
end_state = dict(interface=interface, vrf=changed_vrf)
if 'configure' in commands:
commands.pop(0)

View file

@ -377,8 +377,6 @@ def main():
proposed = dict((k, v) for k, v in args.items() if v is not None)
existing = get_existing_vrrp(interface, group, module, name)
changed = False
end_state = existing
commands = []
if state == 'present':

View file

@ -191,7 +191,6 @@ class ActionModule(ActionBase):
timeout = self.socket_timeout
local_file = self.playvals['local_file']
file_system = self.playvals['file_system']
file_size = os.path.getsize(local_file)
if not self.enough_space(local_file, file_system):
raise AnsibleError('Could not transfer file. Not enough space on device.')