add pci_devices to anonymous statistic
Nailgun agent collects some anonymous statistic of Fuel usage. This statistic consists lshw output, but lshw part of report doesn't send to stat db. Remove excess copying in get_node_meta function. Now it returns full meta dict inculding pci_devices dict. Also added tests for new meta dict params and fixed test env config for this tests. Closes-Bug: #1597276 Change-Id: I7273f953250fd5bd96f7603fbe6b3a658ba79950
This commit is contained in:
parent
dc26901b91
commit
2a937db7d0
|
@ -351,6 +351,20 @@
|
|||
["1.0", "2.1"],
|
||||
["2.1", "1.0"]
|
||||
]
|
||||
},
|
||||
"pci_devices": {
|
||||
"id": "host.domain.tld",
|
||||
"class" : "system",
|
||||
"product" : "MS-7676 (To be filled by O.E.M.)",
|
||||
"vendor" : "MSI",
|
||||
"serial" : "To be filled by O.E.M.",
|
||||
"configuration" : {
|
||||
"boot" : "normal",
|
||||
"chassis" : "desktop",
|
||||
"family" : "To be filled by O.E.M.",
|
||||
"sku" : "To be filled by O.E.M.",
|
||||
"uuid" : "00000000-0000-0000-0000-8C89A5332338"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timestamp": "",
|
||||
|
|
|
@ -319,27 +319,20 @@ class InstallationInfo(object):
|
|||
|
||||
def get_node_meta(self, node):
|
||||
meta = copy.deepcopy(node.meta)
|
||||
result = {}
|
||||
|
||||
if not meta:
|
||||
return result
|
||||
return {}
|
||||
|
||||
to_copy = ['cpu', 'memory', 'disks']
|
||||
for param in to_copy:
|
||||
result[param] = meta.get(param)
|
||||
if isinstance(meta.get('system'), dict):
|
||||
meta['system'].pop('fqdn', None)
|
||||
meta['system'].pop('serial', None)
|
||||
|
||||
system = meta.get('system', {})
|
||||
system.pop('fqdn', None)
|
||||
system.pop('serial', None)
|
||||
result['system'] = system
|
||||
if isinstance(meta.get('interfaces'), list):
|
||||
for interface in meta['interfaces']:
|
||||
if isinstance(interface, dict):
|
||||
interface.pop('mac', None)
|
||||
|
||||
interfaces = meta.get('interfaces', [])
|
||||
result['interfaces'] = []
|
||||
for interface in interfaces:
|
||||
interface.pop('mac')
|
||||
result['interfaces'].append(interface)
|
||||
|
||||
return result
|
||||
return meta
|
||||
|
||||
def get_nodes_info(self, nodes):
|
||||
nodes_info = []
|
||||
|
|
|
@ -282,6 +282,12 @@ class TestInstallationInfo(BaseTestCase):
|
|||
self.assertNotIn('mac', iface)
|
||||
self.assertNotIn('fqdn', node_info['meta']['system'])
|
||||
self.assertNotIn('serial', node_info['meta']['system'])
|
||||
self.assertIn('cpu', node_info['meta'])
|
||||
self.assertIn('memory', node_info['meta'])
|
||||
self.assertIn('disks', node_info['meta'])
|
||||
self.assertIn('pci_devices', node_info['meta'])
|
||||
self.assertIn('interfaces', node_info['meta'])
|
||||
self.assertIn('numa_topology', node_info['meta'])
|
||||
|
||||
self.assertEquals(node_info['pending_addition'],
|
||||
node.pending_addition)
|
||||
|
|
Loading…
Reference in New Issue