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
799 stars 220 forks source link

[Bug]: Using HDiff feature always displays Info log output #303

Open jrpell opened 1 month ago

jrpell commented 1 month ago

Contact Details

What happened?

When using the HDiff class, it should just create the assigned object and not display anything, but it always displays multiple INFO log messages. This shouldn't do this every single time a class is used in my opinion. I've tested in both 1.9.41 and 1.9.51 with the same results:

Here's what it shows:

>>> diff = HDiff(before_config=cfg_int.splitlines(), after_config=cfg_run.splitlines())
2024-10-03 14:04:37.567 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.569 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.567 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.569 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`

CiscoConfParse Version

Version 1.9.41 and 1.9.51

What Operating System are you using?

Linux - Debian, Ubuntu, CentOS, RHEL or others

What Python version(s) have this problem?

Other (please specify)

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

I'm using Python 3.11.  Simply run the command below based on normal string configs from a running config versus an intended config:

cfg_run = """line con 0
 session-timeout 15 output
 exec-timeout 15 0
 logging synchronous
 no modem enable
 history size 50
 transport output telnet ssh
 stopbits 1"""

cfg_int = """line con 0
 session-timeout 15 output
 exec-timeout 15 0
 logging synchronous
 history size 50
 transport output telnet ssh
 stopbits 1"""

diff = HDiff(before_config=cfg_int.splitlines(), after_config=cfg_run.splitlines())

It should just create my object with no output, but instead it outputs several lines of INFO logging every single time. I do not want any logging output any time this class is used. It shouldn't output anything. Here's what it shows:

>>> diff = HDiff(before_config=cfg_int.splitlines(), after_config=cfg_run.splitlines())
2024-10-03 14:04:37.567 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.569 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.567 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.569 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`

I've made sure debug is zero but that doesn't change anything. How can I force this logging to not show? Or if it's forced to show it all the time, then we should have the option to remove it.


### Python tracebacks

```shell
No tracebacks.

Relevant log output

>>> diff = HDiff(before_config=cfg_int.splitlines(), after_config=cfg_run.splitlines())
2024-10-03 14:04:37.567 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.569 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.567 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`
2024-10-03 14:04:37.569 | INFO     | ciscoconfparse.ciscoconfparse:__init__:701 - As of version 1.9.17 and later, `ignore_blank_lines=True` is only honored when `factory=True`


### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/mpenning/ciscoconfparse/blob/main/CONTRIBUTING.md)
mpenning commented 3 days ago

Sadly ciscoconfparse is End of Life. Please see #305