Fix inventory crash on nvme binary too old or absent (#170)
* When nvme binary absent or too old and no json output, this crash the inventory, i prefer just pass nvme inventory and continue * log if nvme-cli is not installed
This commit is contained in:
parent
00653628c6
commit
0f2cb531ae
1 changed files with 22 additions and 16 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…
Add table
editor.link_modal.header
Reference in a new issue