Skip to content

Conversation

@julmanglano
Copy link
Contributor

Have you:

  • Updated the README if necessary?
  • Updated any configuration settings?
  • Written a unit test?

Change Notes

Added a check to handle whitespace at start of config inputs, avoiding the self.config_lines[-1] IndexError.
Added unit test(s) to cover configs with leading whitespaces.

Justification

Closes #656

@itdependsnetworks
Copy link
Contributor

Closing based on: #656 (comment)

@qduk
Copy link
Collaborator

qduk commented May 22, 2025

It looks like this currently accounts for just the first line having a leading space. Would we need to account for any top level line possibly having a space even though that isn't valid syntax?

@jeffkala jeffkala merged commit d7230f5 into networktocode:develop Jul 31, 2025
18 checks passed
michalis1 pushed a commit to michalis1/netutils that referenced this pull request Feb 2, 2026
* Catching leading spaces at config start

* spacing tests

* after black

* remoing wrong variable assigment

* adding parametrize

* reforming

* black formatting

* Update tests/unit/test_parser.py

Co-authored-by: Ken Celenza <[email protected]>

* disable=redefined-outer-name

* fromatting...

---------

Co-authored-by: Ken Celenza <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConfigParser crashes with IndexError when config starts with a leading space

4 participants