Skip to content

Commit

Permalink
Merge pull request #23 from jmcgill298/config_left
Browse files Browse the repository at this point in the history
Bug Fix: addition happening to dict and int instead of len(dict) and int
  • Loading branch information
jtdub authored May 29, 2018
2 parents e2361de + 207f9e6 commit 19b81ca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hier_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import re

__version__ = '1.2.1'
__version__ = '1.2.2'


class HConfig(HConfigChild):
Expand Down
2 changes: 1 addition & 1 deletion hier_config/hc_child.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/test_hier_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 19b81ca

Please sign in to comment.