mpenning / ciscoconfparse

Parse, Audit, Query, Build, and Modify Arista / Cisco / Juniper / Palo Alto / F5 configurations.
http://www.pennington.net/py/ciscoconfparse/
GNU General Public License v3.0
793 stars 220 forks source link

Cisco IOS Banner issue when run CiscoConfParse #5

Closed codechang closed 10 years ago

codechang commented 10 years ago

when running CiscoConfParse for IOS configuration which included banner settings. The CiscoConfParse will show error. Attached testing config and error output. Thank you!

=== Python 2.7.5 === from ciscoconfparse import CiscoConfParse

p = CiscoConfParse("config.txt")

=== Tested config === ! spanning-tree mode pvst spanning-tree extend system-id no spanning-tree vlan 450-451 ! ! banner motd ^CCCC


* * UNAUTHORIZED ACCESS PROHIBITED \ **


* * UNAUTHORIZED USE PROHIBITED \ **




^C ! ! end

======= Error ======= Traceback (most recent call last): File "C:/My Projects/test1/t1.py", line 4, in p = CiscoConfParse("config.txt") File "C:\Python27\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 125, in init ignore_blank_lines=ignore_blank_lines) File "C:\Python27\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 1278, in init self._bootstrap_obj_init(data) File "C:\Python27\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 1419, in _bootstrap_obj_init self.maintain_obj_sanity() File "C:\Python27\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 1432, in maintain_obj_sanity self._mark_banner("motd", "ios") File "C:\Python27\lib\site-packages\ciscoconfparse\ciscoconfparse.py", line 1547, in _mark_banner if (DBGFLAG is True): NameError: global name 'DBGFLAG' is not defined Process finished with exit code 1

mpenning commented 10 years ago

Thank you very much for reporting this bug. Version 0.9.25 does not have this problem; so you could downgrade with pip install ciscoconfparse==0.9.25. I will try to fix this problem ASAP when I get home from work.

mpenning commented 10 years ago

This should be fixed in ciscoconfparse version 0.9.31. Thank you for reporting this problem.