Fix legacy facts keys having redundant underscore (#65167)

Signed-off-by: NilashishC <nilashishchakraborty8@gmail.com>
This commit is contained in:
Nilashish Chakraborty 2019-11-22 15:02:18 +05:30 committed by GitHub
parent 3dc113fd9a
commit 62c4ff8174
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -558,44 +558,44 @@ class Legacy(FactsBase):
if isinstance(data, dict):
self.facts.update(self.transform_dict(data, self.VERSION_MAP))
else:
self.facts['_hostname'] = self.parse_hostname(data)
self.facts['_os'] = self.parse_os(data)
self.facts['_platform'] = self.parse_platform(data)
self.facts['hostname'] = self.parse_hostname(data)
self.facts['os'] = self.parse_os(data)
self.facts['platform'] = self.parse_platform(data)
data = self.run('show interface', output='json')
if data:
if isinstance(data, dict):
self.facts['_interfaces_list'] = self.parse_structured_interfaces(data)
self.facts['interfaces_list'] = self.parse_structured_interfaces(data)
else:
self.facts['_interfaces_list'] = self.parse_interfaces(data)
self.facts['interfaces_list'] = self.parse_interfaces(data)
data = self.run('show vlan brief', output='json')
if data:
if isinstance(data, dict):
self.facts['_vlan_list'] = self.parse_structured_vlans(data)
self.facts['vlan_list'] = self.parse_structured_vlans(data)
else:
self.facts['_vlan_list'] = self.parse_vlans(data)
self.facts['vlan_list'] = self.parse_vlans(data)
data = self.run('show module', output='json')
if data:
if isinstance(data, dict):
self.facts['_module'] = self.parse_structured_module(data)
self.facts['module'] = self.parse_structured_module(data)
else:
self.facts['_module'] = self.parse_module(data)
self.facts['module'] = self.parse_module(data)
data = self.run('show environment fan', output='json')
if data:
if isinstance(data, dict):
self.facts['_fan_info'] = self.parse_structured_fan_info(data)
self.facts['fan_info'] = self.parse_structured_fan_info(data)
else:
self.facts['_fan_info'] = self.parse_fan_info(data)
self.facts['fan_info'] = self.parse_fan_info(data)
data = self.run('show environment power', output='json')
if data:
if isinstance(data, dict):
self.facts['_power_supply_info'] = self.parse_structured_power_supply_info(data)
self.facts['power_supply_info'] = self.parse_structured_power_supply_info(data)
else:
self.facts['_power_supply_info'] = self.parse_power_supply_info(data)
self.facts['power_supply_info'] = self.parse_power_supply_info(data)
def parse_structured_interfaces(self, data):
objects = list()