more fixes

This commit is contained in:
Solvik Blum 2019-08-03 23:57:36 +02:00
commit eaaf565b37
No known key found for this signature in database
GPG key ID: CC12B3DC262B6C47
6 changed files with 14 additions and 14 deletions

View file

@ -6,11 +6,11 @@ class DellHost(ServerBase):
return self.get_product_name().startswith('PowerEdge M')
def get_blade_slot(self):
'''
"""
Return blade slot
dmidecode output is:
` Location In Chassis: Slot 03`
'''
"""
if self.is_blade():
return int(self.dmi.get_by_type('Baseboard')[0].get('Location In Chassis').split()[1])
return None

View file

@ -58,10 +58,10 @@ for type_id, type_str in _type2str.items():
def parse():
'''
"""
parse the full output of the dmidecode
command and return a dic containing the parsed information
'''
"""
buffer = _execute_cmd()
if isinstance(buffer, bytes):
buffer = buffer.decode('utf-8')
@ -70,7 +70,7 @@ def parse():
def get_by_type(type_id):
'''
"""
filter the output of dmidecode per type
0 BIOS
1 System
@ -115,7 +115,7 @@ def get_by_type(type_id):
40 Additional Information
41 Onboard Devices Extended Information
42 Management Controller Host Interface
'''
"""
if isinstance(type_id, str):
type_id = _str2type[type_id]

View file

@ -11,11 +11,11 @@ class HPHost(ServerBase):
return self.get_product_name().startswith('ProLiant BL')
def _find_rack_locator(self):
'''
"""
Depending on the server, the type of the `HP ProLiant System/Rack Locator`
can change.
So we need to find it every time
'''
"""
# FIXME: make a dmidecode function get_by_dminame() ?
if self.is_blade():
for key, value in self.dmi.parse().items():

View file

@ -22,15 +22,15 @@ class ServerBase():
self.network_cards = []
def get_product_name(self):
'''
"""
Return the Chassis Name from dmidecode info
'''
"""
return self.system[0]['Product Name']
def get_service_tag(self):
'''
"""
Return the Service Tag from dmidecode info
'''
"""
return self.system[0]['Serial Number']
def is_blade(self):

View file

@ -12,7 +12,7 @@ setup(
include_package_data=True,
use_scm_version=True,
packages=find_packages(),
install_requires=open('requirements.txt').readlines(),
install_requires=find_packages(),
zip_safe=False,
keywords=['netbox'],
classifiers=[

View file

@ -20,7 +20,7 @@ max-line-length = 99
import-order-style = google
# Inform flake8-import-order plugin that `fact` should be treated as a local package name.
application-import-names = fact
application-import-names = netbox_agent
# [testenv]
# setenv =