Project cleanup (#6)

* add requirements.txt

* Create LICENSE

* add test directory

* code cleanup

* flake8 fixes and code cleanup

* setup.py and tox.ini

* more fixes
This commit is contained in:
Solvik 2019-08-04 00:00:22 +02:00 committed by GitHub
parent 9673bb00b5
commit 396c4b5d10
13 changed files with 385 additions and 59 deletions

View file

@ -1,18 +1,16 @@
import socket
from pprint import pprint
from netbox_agent.server import ServerBase
class DellHost(ServerBase):
def is_blade(self):
return self.get_product_name().startswith('PowerEdge M')
def get_blade_slot(self):
'''
"""
Return blade slot
dmidecode output is:
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
@ -26,4 +24,3 @@ class DellHost(ServerBase):
if self.is_blade():
return self.dmi.get_by_type('chassis')[0]['Serial Number']
return self.get_service_tag()