Skip to content

Commit

Permalink
Add explicit note about infinite recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 15, 2023
1 parent 1034dab commit 72652a8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ciscoconfparse/ccp_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3358,9 +3358,10 @@ def number(self):
# Shortcut invalid interface configurations...
if self.slot is None and self.card is None and self.port is None:
error = f"Could not parse into _number: _slot: {self._slot} _card: {self._card} _port: {self._port} _digit_separator: {self.digit_separator}"
logger.critical(error)
logger.error(error)
# Use sys.exit(1) here to avoid infinite recursion during
# pathological errors such as a dash in an interface range
logger.critical("Exit on `CiscoInterface()` failure to avoid infinite recursion during raise ValueError()")
sys.exit(1)

# Fix regex port parsing problems... relocate _slot and _card, as-required
Expand Down Expand Up @@ -3422,8 +3423,8 @@ def slot_card_port_subinterface_channel(self):
def slot_card_port_subinterface_channel(self, value):
if isinstance(value, str):
if '-' in value:
error = f"Dashes are invalid in `slot_card_port_subinterface_channel`: '{value}'"
logger.critical(error)
error = f"Dashes are invalid in `slot_card_port_subinterface_channel`: '{value}'{os.linesep}"
logger.error(error)
raise InvalidCiscoInterface(error)
else:
self._slot_card_port_subinterface_channel = value
Expand Down

0 comments on commit 72652a8

Please sign in to comment.