Skip to content

Commit aa5edd8

Browse files
committed
node-create: make node type and com type case insensitive
1 parent 662fd9b commit aa5edd8

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

linstor/linstorapi.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -700,17 +700,19 @@ def node_create(
700700
:return: A list containing ApiCallResponses from the controller.
701701
:rtype: list[ApiCallResponse]
702702
"""
703-
if node_type not in self._node_types:
703+
node_type_lower = node_type.lower()
704+
if node_type_lower not in [nt.lower() for nt in self._node_types]:
704705
raise LinstorError(
705706
"Unknown node type '{nt}'. Known types are: {kt}".format(nt=node_type, kt=", ".join(self._node_types))
706707
)
707708

708709
if port is None:
709-
if com_type == apiconsts.VAL_NETCOM_TYPE_PLAIN:
710+
com_lower = com_type.lower()
711+
if com_lower == apiconsts.VAL_NETCOM_TYPE_PLAIN.lower():
710712
port = apiconsts.DFLT_CTRL_PORT_PLAIN \
711-
if node_type == apiconsts.VAL_NODE_TYPE_CTRL else apiconsts.DFLT_STLT_PORT_PLAIN
712-
elif com_type == apiconsts.VAL_NETCOM_TYPE_SSL:
713-
if node_type == apiconsts.VAL_NODE_TYPE_STLT:
713+
if node_type_lower == apiconsts.VAL_NODE_TYPE_CTRL.lower() else apiconsts.DFLT_STLT_PORT_PLAIN
714+
elif com_lower == apiconsts.VAL_NETCOM_TYPE_SSL.lower():
715+
if node_type_lower == apiconsts.VAL_NODE_TYPE_STLT.lower():
714716
port = apiconsts.DFLT_STLT_PORT_SSL
715717
else:
716718
port = apiconsts.DFLT_CTRL_PORT_SSL

0 commit comments

Comments
 (0)