Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion netutils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Initialization file for library."""

__version__ = "0.2.2"
__version__ = "0.2.3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing this out, this actually has to be fixed in a few places. You can remove this and squash, i'll update in another PR

2 changes: 1 addition & 1 deletion netutils/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def _update_same_line_children_configs(self):
"""Update parents in ``self.config_lines`` per ``self.same_line_children``."""
new_config_lines = []
for line in self.config_lines:
if line in self.same_line_children:
if line in self.same_line_children and line.config_line[0].isspace():
previous_line = new_config_lines[-1]
previous_config_line = previous_line.config_line
current_parents = previous_line.parents + (previous_config_line,)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "netutils"
version = "0.2.2"
version = "0.2.3"
description = "Common helper functions useful in network automation."
authors = ["Network to Code, LLC <opensource@networktocode.com>"]
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
!
logging history size 500
logging origin-id hostname
logging source-interface Loopback0
logging host 10.5.84.24
!
logging trap informational
!
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
features = [
{"name": "log", "ordered": True, "section": ["logging ", "no logging "]},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grelleum , sorry, I realize that I did this, but can you add a feature for snmp as well? I think it was failing before with a stracktrace, and hence this test, but I think that we should now be clear about the expectation of a duplicate line.

e.g. add,
{"name": "snmp", "ordered": False, "section": ["snmp-server "]},

]
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
logging source-interface Loopback0
logging host 10.1.1.1
!
logging trap informational
!
snmp-server community <<REPLACED>> RO SNMP_ACL_RO
snmp-server community <<REPLACED>> RW SNMP_ACL_RW
snmp-server community <<REPLACED>> RO SNMP_ACL_RO
!
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"log": {
"compliant": false,
"missing": "logging host 10.1.1.1",
"extra": "logging history size 500\nlogging origin-id hostname\nlogging host 10.5.84.24",
"cannot_parse": true,
"unordered_compliant": false,
"ordered_compliant": false,
"actual": "logging history size 500\nlogging origin-id hostname\nlogging source-interface Loopback0\nlogging host 10.5.84.24\nlogging trap informational",
"intended": "logging source-interface Loopback0\nlogging host 10.1.1.1\nlogging trap informational"
}
}