Adds a generic vendor for unrecognizable systems #105
2 changed files with 30 additions and 1 deletions
|
@ -5,6 +5,7 @@ from netbox_agent.vendors.dell import DellHost
|
|||
from netbox_agent.vendors.hp import HPHost
|
||||
from netbox_agent.vendors.qct import QCTHost
|
||||
from netbox_agent.vendors.supermicro import SupermicroHost
|
||||
from netbox_agent.vendors.generic import GenericHost
|
||||
|
||||
MANUFACTURERS = {
|
||||
'Dell Inc.': DellHost,
|
||||
|
@ -12,12 +13,17 @@ MANUFACTURERS = {
|
|||
'HPE': HPHost,
|
||||
'Supermicro': SupermicroHost,
|
||||
'Quanta Cloud Technology Inc.': QCTHost,
|
||||
'Generic': GenericHost,
|
||||
}
|
||||
|
||||
|
||||
def run(config):
|
||||
manufacturer = dmidecode.get_by_type('Chassis')[0].get('Manufacturer')
|
||||
server = MANUFACTURERS[manufacturer](dmi=dmidecode)
|
||||
|
||||
try:
|
||||
server = MANUFACTURERS[manufacturer](dmi=dmidecode)
|
||||
except: KeyError:
|
||||
server = MANUFACTURERS["Generic"]
|
||||
|
||||
if config.debug:
|
||||
server.print_debug()
|
||||
|
|
23
netbox_agent/vendors/generic.py
vendored
Normal file
23
netbox_agent/vendors/generic.py
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
import netbox_agent.dmidecode as dmidecode
|
||||
from netbox_agent.server import ServerBase
|
||||
|
||||
|
||||
class GenericHost(ServerBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(GenericHost, self).__init__(*args, **kwargs)
|
||||
self.manufacturer = dmidecode.get_by_type('Baseboard')[0].get('Manufacturer')
|
||||
|
||||
def is_blade(self):
|
||||
return None
|
||||
|
||||
def get_blade_slot(self):
|
||||
return None
|
||||
|
||||
def get_chassis_name(self):
|
||||
return None
|
||||
|
||||
def get_chassis(self):
|
||||
return self.get_product_name()
|
||||
|
||||
def get_chassis_service_tag(self):
|
||||
return self.get_service_tag()
|
Loading…
Reference in a new issue