Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crmsh/corosync.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ def update_link(self, linknumber: int, options: dict[str, str|None]) -> dict:
Returns: updated configuration dom. The internal state of LinkManager is also updated.
"""
links = self.links()
if links[linknumber] is None:
if linknumber >= KNET_LINK_NUM_LIMIT or links[linknumber] is None:
raise ValueError(f'Link {linknumber} does not exist.')
if 'nodes' in options:
raise ValueError('Unknown option "nodes".')
Expand Down Expand Up @@ -735,7 +735,7 @@ def update_node_addr(self, linknumber: int, node_addresses: typing.Mapping[int,
Returns: updated configuration dom. The internal state of LinkManager is also updated.
"""
links = self.links()
if links[linknumber] is None:
if linknumber >= KNET_LINK_NUM_LIMIT or links[linknumber] is None:
raise ValueError(f'Link {linknumber} does not exist.')
return self.__upsert_node_addr_impl(self._config, links, linknumber, node_addresses)

Expand Down Expand Up @@ -804,7 +804,7 @@ def remove_link(self, linknumber: int) -> dict:
Returns: updated configuration dom. The internal state of LinkManager is also updated.
"""
links = self.links()
if links[linknumber] is None:
if linknumber >= KNET_LINK_NUM_LIMIT or links[linknumber] is None:
raise ValueError(f'Link {linknumber} does not exist.')
if sum(1 if link is not None else 0 for link in links) <= 1:
raise ValueError(f'Cannot remove the last link.')
Expand Down
2 changes: 1 addition & 1 deletion crmsh/ui_corosync.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __parse_linknumber(args: typing.Sequence[str], i: int):
try:
return int(args[i])
except ValueError:
raise SyntaxError(f'expected linknumber, actual {args[i]}')
raise LinkArgumentParser.SyntaxException(f'expected linknumber, actual {args[i]}')

@staticmethod
def __parse_node_spec(args: typing.Sequence[str], i: int):
Expand Down