ciscoconfparse icon indicating copy to clipboard operation
ciscoconfparse copied to clipboard

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

Open hypermanganate opened this issue 3 years ago • 1 comments

Contact Details

[email protected]

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

hypermanganate avatar May 26 '22 13:05 hypermanganate

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] avatar Jul 26 '22 03:07 github-actions[bot]

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

github-actions[bot] avatar Aug 25 '22 03:08 github-actions[bot]