1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

nxos_facts cleanup (#26192)

This commit is contained in:
Nathaniel Case 2017-07-13 16:56:04 -04:00 committed by GitHub
parent f3acf9c929
commit 62e4353ba1

View file

@ -52,17 +52,6 @@ options:
"""
EXAMPLES = """
# Note: examples below use the following provider dict to handle
# transport and authentication to the node.
---
vars:
cli:
host: "{{ inventory_hostname }}"
username: admin
password: admin
transport: cli
---
- nxos_facts:
gather_subset: all
@ -233,6 +222,7 @@ class Default(FactsBase):
if data:
self.facts.update(self.transform_dict(data, self.VERSION_MAP))
class Config(FactsBase):
def populate(self):
@ -243,7 +233,6 @@ class Config(FactsBase):
class Hardware(FactsBase):
def populate(self):
cmd = {'command': 'dir', 'output': 'text'},
data = self.run('dir', 'text')
if data:
self.facts['filesystems'] = self.parse_filesystems(data)
@ -321,8 +310,7 @@ class Interfaces(FactsBase):
if data.startswith('ERROR'):
return dict()
lines = data.split('\n')
regex = re.compile('(\S+)\s+(\S+)\s+\d+\s+\w+\s+(\S+)')
regex = re.compile(r'(\S+)\s+(\S+)\s+\d+\s+\w+\s+(\S+)')
for item in data.split('\n')[4:-1]:
match = regex.match(item)
@ -358,6 +346,7 @@ class Interfaces(FactsBase):
intf['ipv6'] = self.transform_dict(item, self.INTERFACE_IPV6_MAP)
self.facts['all_ipv6_addresses'].append(item['ROW_intf']['addr'])
class Legacy(FactsBase):
# facts from nxos_facts 2.1
@ -457,6 +446,7 @@ FACT_SUBSETS = dict(
VALID_SUBSETS = frozenset(FACT_SUBSETS.keys())
def main():
spec = dict(
gather_subset=dict(default=['!config'], type='list')