Skip to content

Commit

Permalink
Add many enhancements for CiscoRange()
Browse files Browse the repository at this point in the history
  • Loading branch information
mpenning committed Oct 13, 2023
1 parent 9b6b40c commit 0b29fa0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ciscoconfparse/ccp_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3343,7 +3343,7 @@ class CiscoRange(MutableSequence):

# This method is on CiscoRange()
@logger.catch(reraise=True)
def __init__(self, text="", result_type=str, debug=False):
def __init__(self, text="", result_type=str, default_iter_attr='port', debug=False):
super().__init__()

if not isinstance(text, str):
Expand All @@ -3356,6 +3356,7 @@ def __init__(self, text="", result_type=str, debug=False):

self.text = text
self.iterate_attribute = None
self.default_iter_attr = default_iter_attr
self._list = self.parse_text_list(text, debug=debug)

# This method is on CiscoRange()
Expand Down Expand Up @@ -3387,6 +3388,8 @@ def parse_text_list(self, text, debug=False):
logger.info(f" CiscoRange(text={text}, debug=True) ITERATE on --> {potential_iter_attr} <--")
self.iterate_attribute = potential_iter_attr
break
if self.iterate_attribute is None:
self.iterate_attribute = self.default_iter_attr

end_ordinal = int(raw_part.split("-")[1].strip())
else:
Expand Down

0 comments on commit 0b29fa0

Please sign in to comment.