IPMI doesn't mandate a username or password so tripleo shouldn't either
Give driver types a little more flexibility in defining which fields are mandated. Blueprint: multiarch-support Related-Bug: 1715787 Change-Id: I6c72b03512a0815326a1b62bc88231b17340c45f
This commit is contained in:
parent
ea44ebe886
commit
ca290cf4af
|
@ -1111,8 +1111,10 @@ class TestValidateNodes(base.TestCase):
|
|||
|
||||
def test_missing_fields(self):
|
||||
for field in ('pm_addr', 'pm_user', 'pm_password'):
|
||||
# NOTE(tonyb): We can't use ipmi here as it's fine with some of
|
||||
# these fields being missing.
|
||||
nodes_json = [
|
||||
{'pm_type': 'pxe_ipmitool',
|
||||
{'pm_type': 'pxe_drac',
|
||||
'pm_addr': '1.1.1.1',
|
||||
'pm_user': 'root',
|
||||
'pm_password': 'p@$$w0rd'},
|
||||
|
@ -1123,6 +1125,17 @@ class TestValidateNodes(base.TestCase):
|
|||
'fields are missing: %s' % field,
|
||||
nodes.validate_nodes, nodes_json)
|
||||
|
||||
def test_ipmi_missing_user_ok(self):
|
||||
nodes_json = [
|
||||
{'pm_type': 'ipmi',
|
||||
'pm_addr': '1.1.1.1',
|
||||
'pm_password': 'p@$$w0rd'},
|
||||
]
|
||||
|
||||
# validate_nodes() doesn't have an explicit return which means python
|
||||
# gives us None
|
||||
self.assertEqual(None, nodes.validate_nodes(nodes_json))
|
||||
|
||||
def test_duplicate_redfish_node(self):
|
||||
nodes_json = [
|
||||
{'pm_type': 'redfish',
|
||||
|
|
|
@ -121,13 +121,14 @@ class DriverInfo(object):
|
|||
class PrefixedDriverInfo(DriverInfo):
|
||||
def __init__(self, prefix, deprecated_mapping=None,
|
||||
has_port=False, address_field='address',
|
||||
default_port=None, hardware_type=None):
|
||||
default_port=None, hardware_type=None,
|
||||
mandatory_fields=None):
|
||||
mapping = {
|
||||
'pm_addr': '%s_%s' % (prefix, address_field),
|
||||
'pm_user': '%s_username' % prefix,
|
||||
'pm_password': '%s_password' % prefix,
|
||||
}
|
||||
mandatory_fields = list(mapping)
|
||||
mandatory_fields = mandatory_fields or list(mapping)
|
||||
|
||||
if has_port:
|
||||
mapping['pm_port'] = '%s_port' % prefix
|
||||
|
@ -267,7 +268,9 @@ DRIVER_INFO = {
|
|||
# production drivers
|
||||
'(ipmi|.*_ipmitool)': PrefixedDriverInfo('ipmi', has_port=True,
|
||||
default_port=623,
|
||||
hardware_type='ipmi'),
|
||||
hardware_type='ipmi',
|
||||
mandatory_fields=['pm_addr']
|
||||
),
|
||||
'(idrac|.*_drac)': PrefixedDriverInfo('drac', has_port=True,
|
||||
hardware_type='idrac'),
|
||||
'(ilo|.*_ilo)': PrefixedDriverInfo('ilo', has_port=True,
|
||||
|
|
Loading…
Reference in New Issue