fixes for CI.
This commit is contained in:
parent
a9b6b039c6
commit
f4ff32f1b0
3 changed files with 35 additions and 38 deletions
|
|
@ -1,21 +1,15 @@
|
|||
import logging
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
from netbox_agent.config import netbox_instance as nb, config
|
||||
from netbox_agent.misc import is_tool
|
||||
from netbox_agent.raid.hp import HPRaid
|
||||
from netbox_agent.raid.storcli import StorcliRaid
|
||||
from netbox_agent.lshw import LSHW
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
INVENTORY_TAG = {
|
||||
'cpu': {'name': 'hw:cpu', 'slug': 'hw-cpu'},
|
||||
'disk': {'name': 'hw:disk', 'slug': 'hw-disk'},
|
||||
'interface':{'name': 'hw:interface', 'slug':'hw-interface'},
|
||||
'interface': {'name': 'hw:interface', 'slug': 'hw-interface'},
|
||||
'memory': {'name': 'hw:memory', 'slug': 'hw-memory'},
|
||||
'motherboard':{'name': 'hw:motherboard', 'slug':'hw-motherboard'},
|
||||
'motherboard': {'name': 'hw:motherboard', 'slug': 'hw-motherboard'},
|
||||
'raid_card': {'name': 'hw:raid_card', 'slug': 'hw-raid-card'},
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +103,12 @@ class Inventory():
|
|||
description=description
|
||||
)
|
||||
|
||||
logging.info('Creating inventory item {} {}/{} {} '.format(vendor, name, serial, description))
|
||||
logging.info('Creating inventory item {} {}/{} {} '.format(
|
||||
vendor,
|
||||
name,
|
||||
serial,
|
||||
description)
|
||||
)
|
||||
|
||||
def get_hw_motherboards(self):
|
||||
motherboards = []
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
import logging
|
||||
|
||||
import subprocess
|
||||
import getpass
|
||||
import json
|
||||
|
||||
from pprint import pprint
|
||||
|
||||
class LSHW():
|
||||
def __init__(self):
|
||||
|
|
@ -80,7 +77,8 @@ class LSHW():
|
|||
self.disks.append(d)
|
||||
|
||||
elif "nvme" in obj["configuration"]["driver"]:
|
||||
nvme = json.loads(subprocess.check_output(["nvme", '-list', '-o', 'json'],encoding='utf8'))
|
||||
nvme = json.loads(subprocess.check_output(["nvme", '-list', '-o', 'json'],
|
||||
encoding='utf8'))
|
||||
|
||||
d = {}
|
||||
d["vendor"] = obj["vendor"]
|
||||
|
|
@ -96,7 +94,6 @@ class LSHW():
|
|||
self.disks.append(d)
|
||||
|
||||
def find_cpus(self, obj):
|
||||
pprint(obj)
|
||||
c = {}
|
||||
c["product"] = obj["product"]
|
||||
c["vendor"] = obj["vendor"]
|
||||
|
|
@ -107,7 +104,7 @@ class LSHW():
|
|||
|
||||
def find_memories(self, obj):
|
||||
if "children" not in obj:
|
||||
print("not a DIMM memory.")
|
||||
# print("not a DIMM memory.")
|
||||
return
|
||||
|
||||
for dimm in obj["children"]:
|
||||
|
|
|
|||
3
netbox_agent/vendors/supermicro.py
vendored
3
netbox_agent/vendors/supermicro.py
vendored
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
from netbox_agent.location import Slot
|
||||
from netbox_agent.server import ServerBase
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ from netbox_agent.server import ServerBase
|
|||
|
||||
"""
|
||||
|
||||
|
||||
class SupermicroHost(ServerBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SupermicroHost, self).__init__(*args, **kwargs)
|
||||
|
|
@ -55,4 +57,3 @@ class SupermicroHost(ServerBase):
|
|||
if not self.is_blade():
|
||||
return None
|
||||
return 'Chassis {}'.format(self.get_chassis_service_tag())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue