fix ugly supermicro blade support (#178)

This commit is contained in:
Solvik 2020-12-15 11:32:11 +01:00 committed by GitHub
commit 77a84b365f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -21,7 +21,7 @@ class SupermicroHost(ServerBase):
self.manufacturer = 'Supermicro'
def is_blade(self):
product_name = self.get_product_name()
product_name = self.system[0]['Product Name'].strip()
# Blades
blade = product_name.startswith('SBI')
blade |= product_name.startswith('SBA')
@ -44,19 +44,23 @@ class SupermicroHost(ServerBase):
return None
def get_service_tag(self):
if self.is_blade():
return self.baseboard[0]['Serial Number'].strip()
return self.system[0]['Serial Number'].strip()
def get_product_name(self):
if self.is_blade():
return self.baseboard[0]['Product Name'].strip()
return self.system[0]['Product Name'].strip()
def get_chassis(self):
if self.is_blade():
return self.chassis[0]['Product Name'].strip()
return self.system[0]['Product Name'].strip()
return self.get_product_name()
def get_chassis_service_tag(self):
if self.is_blade():
return self.chassis[0]['Serial Number'].strip()
return self.system[0]['Serial Number'].strip()
return self.get_service_tag()
def get_chassis_name(self):