From 58e7a1f0b42769df55ae52e66f72e0f4138073e1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 4 Jun 2020 14:58:52 -0400 Subject: [PATCH] Recognize ESXi media Fingerprint ESXi media, at least tested with ESXi 7 media. --- confluent_server/confluent/osimage.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/confluent_server/confluent/osimage.py b/confluent_server/confluent/osimage.py index 9f69cfa6..911ed6ce 100644 --- a/confluent_server/confluent/osimage.py +++ b/confluent_server/confluent/osimage.py @@ -20,6 +20,7 @@ READFILES = set([ 'README.diskdefines', 'media.1/products', 'media.2/products', + '.DISCINFO', '.discinfo', ]) @@ -143,6 +144,24 @@ def check_centos(isoinfo): return None return {'name': 'centos-{0}-{1}'.format(ver, arch), 'method': EXTRACT, 'category': cat} +def check_esxi(isoinfo): + if '.DISCINFO' not in isoinfo[1]: + return + isesxi = False + version = None + for line in isoinfo[1]['.DISCINFO'].split(b'\n'): + if b'ESXi' == line: + isesxi = True + if line.startswith(b'Version: '): + _, version = line.split(b' ', 1) + if not isinstance(version, str): + version = version.decode('utf8') + if isesxi and version: + return { + 'name': 'esxi-{0}'.format(version), + 'method': EXTRACT, + 'category': 'esxi{0}'.format(version.split('.', 1)[0]) + } def check_ubuntu(isoinfo): if 'README.diskdefines' not in isoinfo[1]: