wip - test netbox server creation:
This commit is contained in:
parent
dc4f90d490
commit
0f8a09d0cf
9 changed files with 140 additions and 19 deletions
|
|
@ -35,14 +35,20 @@ class IPMI():
|
|||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.ret, self.output = subprocess.getstatusoutput('ipmitool lan print')
|
||||
try:
|
||||
self.ret, self.output = subprocess.getstatusoutput('ipmitool lan print')
|
||||
except Exception as e:
|
||||
self.ret = 42
|
||||
self.output = str(e)
|
||||
|
||||
if self.ret != 0:
|
||||
logging.error('Cannot get ipmi info: {}'.format(self.output))
|
||||
|
||||
def parse(self):
|
||||
ret = {}
|
||||
if self.ret != 0:
|
||||
return ret
|
||||
return None
|
||||
|
||||
ret = {}
|
||||
for line in self.output.splitlines():
|
||||
key = line.split(':')[0].strip()
|
||||
value = ':'.join(line.split(':')[1:]).strip()
|
||||
|
|
|
|||
|
|
@ -234,6 +234,9 @@ class Network():
|
|||
|
||||
def create_or_update_ipmi(self):
|
||||
ipmi = self.get_ipmi()
|
||||
if ipmi is None:
|
||||
return None
|
||||
|
||||
mac = ipmi['MAC Address']
|
||||
ip = ipmi['IP Address']
|
||||
netmask = ipmi['Subnet Mask']
|
||||
|
|
|
|||
Loading…
Add table
editor.link_modal.header
Reference in a new issue