Supermicro server can guess their slot via the config file (#50)

This commit is contained in:
Solvik 2019-08-29 16:13:04 +02:00 committed by GitHub
commit 0faee59bde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 1 deletions

View file

@ -1,3 +1,4 @@
from netbox_agent.location import Slot
from netbox_agent.server import ServerBase
@ -6,6 +7,11 @@ class SupermicroHost(ServerBase):
return self.get_product_name().startswith('SBI')
def get_blade_slot(self):
if self.is_blade():
# Some Supermicro servers don't report the slot in dmidecode
# let's use a regex
slot = Slot()
return slot.get()
# No supermicro on hands
return None