mirror of
https://github.com/xcat2/confluent.git
synced 2025-02-20 12:31:37 +00:00
Merge branch 'pr/23'
This commit is contained in:
commit
a02f96710b
@ -334,6 +334,9 @@ def get_input_message(path, operation, inputdata, nodes=None, multinode=False):
|
||||
elif (path[:3] == ['configuration', 'management_controller', 'identifier']
|
||||
and operation != 'retrieve'):
|
||||
return InputMCI(path, nodes, inputdata)
|
||||
elif (path[:4] == ['configuration', 'management_controller',
|
||||
'net_interfaces', 'management'] and operation != 'retrieve'):
|
||||
return InputNetworkConfiguration(path, nodes, inputdata)
|
||||
elif (path[:3] == ['configuration', 'management_controller', 'domain_name']
|
||||
and operation != 'retrieve'):
|
||||
return InputDomainName(path, nodes, inputdata)
|
||||
@ -581,6 +584,38 @@ class InputMCI(ConfluentInputMessage):
|
||||
return self.inputbynode[node]['identifier']
|
||||
|
||||
|
||||
class InputNetworkConfiguration(ConfluentInputMessage):
|
||||
def __init__(self, path, nodes, inputdata):
|
||||
self.inputbynode = {}
|
||||
self.stripped = False
|
||||
if not inputdata:
|
||||
raise exc.InvalidArgumentException('missing input data')
|
||||
|
||||
if 'hw_addr' in inputdata:
|
||||
raise exc.InvalidArgumentException('hw_addr is a read only field')
|
||||
|
||||
if 'ipv4_address' not in inputdata:
|
||||
inputdata['ipv4_address'] = None
|
||||
|
||||
if 'ipv4_gateway' not in inputdata:
|
||||
inputdata['ipv4_gateway'] = None
|
||||
|
||||
if 'ipv4_configuration' in inputdata:
|
||||
if inputdata['ipv4_configuration'].lower() not in ['dhcp','static']:
|
||||
raise exc.InvalidArgumentException(
|
||||
'Unrecognized ipv4_configuration')
|
||||
else:
|
||||
inputdata['ipv4_configuration'] = None
|
||||
if nodes is None:
|
||||
raise exc.InvalidArgumentException(
|
||||
'This only supports per-node input')
|
||||
for node in nodes:
|
||||
self.inputbynode[node] = inputdata
|
||||
|
||||
def netconfig(self, node):
|
||||
return self.inputbynode[node]
|
||||
|
||||
|
||||
class InputDomainName(ConfluentInputMessage):
|
||||
def __init__(self, path, nodes, inputdata):
|
||||
self.inputbynode = {}
|
||||
@ -590,7 +625,6 @@ class InputDomainName(ConfluentInputMessage):
|
||||
if len(inputdata['domain_name']) > 256:
|
||||
raise exc.InvalidArgumentException(
|
||||
'identifier must be less than or = 256 chars')
|
||||
|
||||
if nodes is None:
|
||||
raise exc.InvalidArgumentException(
|
||||
'This only supports per-node input')
|
||||
|
@ -439,9 +439,12 @@ class IpmiHandler(object):
|
||||
ipv4cfgmethod=lancfg['ipv4_configuration'],
|
||||
hwaddr=lancfg['mac_address']
|
||||
))
|
||||
else:
|
||||
self.output.put(msg.ConfluentNodeError(self.node,
|
||||
'Not yet implemented'))
|
||||
elif self.op == 'update':
|
||||
config = self.inputdata.netconfig(self.node)
|
||||
self.ipmicmd.set_net_configuration(
|
||||
ipv4_address=config['ipv4_address'],
|
||||
ipv4_configuration=config['ipv4_configuration'],
|
||||
ipv4_gateway=config['ipv4_gateway'])
|
||||
|
||||
def handle_users(self):
|
||||
# Create user
|
||||
|
Loading…
x
Reference in New Issue
Block a user