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

[Bug]: IOSCfgLine.delete_children_matching() does not function #241

Closed hypermanganate closed 2 years ago

hypermanganate commented 2 years ago

Contact Details

adam.j.pawlowski@gmail.com

What happened?

I couldn't get this to work, then attempted the example that's in the source code:

`

config2 = [ '!', 'interface Serial1/0', ' description Some lame description', ' ip address 1.1.1.1 255.255.255.252', '!', 'interface Serial1/1', ' description Another lame description', ' ip address 1.1.1.5 255.255.255.252', '!', ] pc2 = CiscoConfParse(config2) for obj in pc2.find_objects(r'^interface'): ... obj.delete_children_matching(r'description') ... for line in pc2.ioscfg: ... print(line) ... ! interface Serial1/0 description Some lame description ip address 1.1.1.1 255.255.255.252 ! interface Serial1/1 description Another lame description ip address 1.1.1.5 255.255.255.252 ! `

The expected output would be for those lines to be removed. The function either always returns a null, or explodes.

CiscoConfParse Version

1.6.40

What Operating System are you using?

Linux - Debian, Ubuntu, CentOS, RHEL or others

What Python version(s) have this problem?

Python 3.7

Show us how to reproduce the problem. Please tell us if the problem is specific to certain inputs or situations.

Followed the example in the code.

I'd also tried it by using "find_objects_w_child" which returns the same list of IOSCfgLine objects, didn't make any difference.

Python tracebacks

No traceback is generated.

Relevant log output

No response

Code of Conduct

github-actions[bot] commented 2 years ago

This issue has automatically been marked stale due to inactivity. The issue will close unless further activity occurs. Please understand that the CiscoConfParse team is not obligated to comment on every issue. For more detailed information, please refer to our CONTRIBUTING guidance -> https://github.com/mpenning/ciscoconfparse/blob/main/.github/CONTRIBUTING.md

github-actions[bot] commented 2 years ago

Due to inactivity, CiscoConfParse's maintainers are closing this issue. Please refrain from further comments. In the future, CiscoConfParse's maintainers may reopen it solely at their own discretion. For more detailed information, please refer to our CONTRIBUTING guidance -> https://github.com/mpenning/ciscoconfparse/blob/main/.github/CONTRIBUTING.md