Module: check_mk
Branch: master
Commit: 5d8f1b65dffda7fada19864ac186fb35fc802008
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5d8f1b65dffda7…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Mon Dec 17 12:43:56 2018 +0100
juniper_bgp_state: fix missing integer conversion
Change-Id: I7d4799938c75a209ff6cf45bba12d8d263693b76
---
checks/juniper_bgp_state | 4 ++--
.../checks/generictests/datasets/juniper_bgp_state_ip_addresses.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/checks/juniper_bgp_state b/checks/juniper_bgp_state
index 6f4c96e..7af961f 100644
--- a/checks/juniper_bgp_state
+++ b/checks/juniper_bgp_state
@@ -30,7 +30,7 @@ def _clean_v4_address(chunks):
def _clean_v6_address(chunks):
- ichunks = iter('%02x' % i for i in chunks)
+ ichunks = iter('%02x' % int(i) for i in chunks)
blocks = ("%s%s" % pair for pair in zip(ichunks, ichunks))
stripped_blocks = ('0' if b == '0000' else b.lstrip('0') for
b in blocks)
v6_string = ':'.join(b for b in stripped_blocks)
@@ -56,7 +56,7 @@ def juniper_bgp_state_create_item(peering_entry):
return _clean_v6_address(peering_entry)
except (ValueError, IndexError):
pass
- return ' '.join('%02X' % i for i in peering_entry) # that's what
has been in the data
+ return ' '.join('%02X' % int(i) for i in peering_entry) # that's
what has been in the data
def parse_juniper_bgp_state(info):
diff --git a/tests/unit/checks/generictests/datasets/juniper_bgp_state_ip_addresses.py
b/tests/unit/checks/generictests/datasets/juniper_bgp_state_ip_addresses.py
index 2164fdf..cec3c9a 100644
--- a/tests/unit/checks/generictests/datasets/juniper_bgp_state_ip_addresses.py
+++ b/tests/unit/checks/generictests/datasets/juniper_bgp_state_ip_addresses.py
@@ -1,8 +1,8 @@
checkname = 'juniper_bgp_state'
info = [
- [u'4', u'1', [222, 173, 190, 239, 0, 64, 1, 17, 0, 0, 0, 0, 0, 0, 0,
1]],
- [u'4', u'2', [0] * 16],
+ [u'4', u'1', [u'222', u'173', u'190',
u'239', u'0', u'64', u'1', u'17', u'0',
u'0', u'0', u'0', u'0', u'0', u'0',
u'1']],
+ [u'4', u'2', [u'0'] * 16],
]
discovery = {'': [('[dead:beef:40:111::1]', {}), ("[::]",
{})]}