Fix inventory crash on nvme binary too old or absent #170
1 changed files with 20 additions and 14 deletions
|
@ -88,6 +88,10 @@ class LSHW():
|
||||||
self.disks.append(d)
|
self.disks.append(d)
|
||||||
|
|
||||||
elif "nvme" in obj["configuration"]["driver"]:
|
elif "nvme" in obj["configuration"]["driver"]:
|
||||||
|
if not is_tool('nvme'):
|
||||||
|
logging.error('nvme-cli >= 1.0 does not seem to be installed')
|
||||||
|
else:
|
||||||
|
try:
|
||||||
nvme = json.loads(
|
nvme = json.loads(
|
||||||
subprocess.check_output(
|
subprocess.check_output(
|
||||||
["nvme", '-list', '-o', 'json'],
|
["nvme", '-list', '-o', 'json'],
|
||||||
|
@ -104,6 +108,8 @@ class LSHW():
|
||||||
d['description'] = "NVME Disk"
|
d['description'] = "NVME Disk"
|
||||||
|
|
||||||
self.disks.append(d)
|
self.disks.append(d)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
def find_cpus(self, obj):
|
def find_cpus(self, obj):
|
||||||
if "product" in obj:
|
if "product" in obj:
|
||||||
|
|
Loading…
Reference in a new issue