extract system uuid of old snapshots
This commit is contained in:
parent
88a164a9ee
commit
5c2c4653a1
|
@ -0,0 +1,36 @@
|
|||
import json
|
||||
import sys
|
||||
|
||||
|
||||
def get_old_smbios_version(snapshot):
|
||||
capabilities = snapshot.get('debug', {}).get('lshw', {}).get('capabilities', {})
|
||||
for x in capabilities.values():
|
||||
if "SMBIOS version" in x:
|
||||
e = x.split("SMBIOS version ")[1].split(".")
|
||||
if int(e[0]) < 3 and int(e[1]) < 6:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_uuid(snapshot):
|
||||
|
||||
return (
|
||||
snapshot.get('debug', {}).get('lshw', {}).get('configuration', {}).get('uuid')
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
_file = sys.argv[1]
|
||||
with open(_file) as file_snapshot:
|
||||
snapshot = json.loads(file_snapshot.read())
|
||||
|
||||
if get_old_smbios_version(snapshot):
|
||||
return
|
||||
|
||||
system_uuid = get_uuid(snapshot)
|
||||
if system_uuid:
|
||||
print("{};{}".format(system_uuid, snapshot['uuid']))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
for i in `ls ../snapshots/*/*.json`; do python examples/extract_uuid.py $i; done > system_uuids.csv
|
Reference in New Issue