use lshw for inventory #58

Merged
ThomasADavis merged 15 commits from lshw-inventory into master 2019-09-05 15:13:37 +02:00
2 changed files with 13 additions and 16 deletions
Showing only changes of commit 88387a595c - Show all commits

View file

@ -86,7 +86,7 @@ class Inventory():
device_id=device_id, device_id=device_id,
tag=tag tag=tag
) )
except: except BaseException:
logging.info('Tag {tag} is missing, returning empty array.'.format(tag=tag)) logging.info('Tag {tag} is missing, returning empty array.'.format(tag=tag))
items = [] items = []

View file

@ -1,5 +1,4 @@
import subprocess import subprocess
import getpass
import json import json
@ -8,8 +7,7 @@ class LSHW():
self.hw_info = json.loads( self.hw_info = json.loads(
subprocess.check_output(["lshw", "-quiet", "-json"], subprocess.check_output(["lshw", "-quiet", "-json"],
encoding='utf8') encoding='utf8')) # noqa: E128
)
self.info = {} self.info = {}
self.memories = [] self.memories = []
@ -82,8 +80,7 @@ class LSHW():
elif "nvme" in obj["configuration"]["driver"]: elif "nvme" in obj["configuration"]["driver"]:
nvme = json.loads( nvme = json.loads(
subprocess.check_output(["nvme", '-list', '-o', 'json'], subprocess.check_output(["nvme", '-list', '-o', 'json'],
encoding='utf8') encoding='utf8')) # noqa: E128
)
d = {} d = {}
d["vendor"] = obj["vendor"] d["vendor"] = obj["vendor"]