use lshw for inventory #58
2 changed files with 13 additions and 16 deletions
|
@ -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 = []
|
||||||
|
|
||||||
|
|
|
@ -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"]
|
||||||
|
|
Loading…
Add table
Reference in a new issue