summaryrefslogtreecommitdiffstats
path: root/src/utils/hw_inventory.py
Commit message (Collapse)AuthorAgeFilesLines
* hw_inventory: use dict.getJose M. Guisado2023-07-211-23/+27
| | | | | | | | | The first stage of parsing the "lshw -json" command output is to load the json string into a Python dictionary. lshw output is large and varies from machine to machine, so it's not safe to assume that different keys will be present in the dictionary. Use dict.get() instead of dict[key] to avoid KeyError exceptions.
* utils: add hw_inventory.pyJose M. Guisado2023-04-181-0/+309
hw_inventory.py defines classes and helpers functions enabling fetching of hardware inventory from a running client. Uses a subprocess call to the command 'lshw -json' to obtain hardware information. Relevant public functions: > get_hardware_inventory() Main function encapsulating subprocess and output processing logic. Returns a HardwareInventory object. > legacy_list_hardware_inventory(inventory) Legacy string representation of parameter HardwareInventory object