From aaad6679cb64daecad7167926f017af6d1b4995a Mon Sep 17 00:00:00 2001 From: jmcgill298 Date: Sat, 26 May 2018 00:20:21 -0400 Subject: [PATCH 1/2] Bug Fix: addition happening to dict and int instead of len(dict) and int --- hier_config/hc_child.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hier_config/hc_child.py b/hier_config/hc_child.py index 4f384ff..a765cea 100644 --- a/hier_config/hc_child.py +++ b/hier_config/hc_child.py @@ -575,7 +575,7 @@ def _config_to_get_to_left(self, target, delta): deleted.negate() if self_child.children: deleted.comments.add( - "removes {} lines".format(len(self_child.children_dict + 1))) + "removes {} lines".format(len(self_child.children_dict) + 1)) def _config_to_get_to_right(self, target, delta): # find what would need to be added to source_config to get to self From 207f9e6899c55b75dc4093a7b0004dcf62696acf Mon Sep 17 00:00:00 2001 From: jame4848 Date: Tue, 29 May 2018 12:58:27 -0500 Subject: [PATCH 2/2] * increment version * update test to catch `hier_config._config_to_get_to_left` errors. --- hier_config/__init__.py | 2 +- tests/test_hier_config.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/hier_config/__init__.py b/hier_config/__init__.py index a7f1d91..e05e510 100644 --- a/hier_config/__init__.py +++ b/hier_config/__init__.py @@ -2,7 +2,7 @@ import re -__version__ = '1.2.1' +__version__ = '1.2.2' class HConfig(HConfigChild): diff --git a/tests/test_hier_config.py b/tests/test_hier_config.py index d278f50..70dc72a 100644 --- a/tests/test_hier_config.py +++ b/tests/test_hier_config.py @@ -290,7 +290,8 @@ def test_negate(self): def test_config_to_get_to(self): running_config_hier = HConfig(self.host_a, self.os, self.options) - running_config_hier.add_child('interface Vlan2') + interface = running_config_hier.add_child('interface Vlan2') + interface.add_child('ip address 192.168.1.1/24') compiled_config_hier = HConfig(self.host_a, self.os, self.options) compiled_config_hier.add_child('interface Vlan3') remediation_config_hier = running_config_hier.config_to_get_to(