From 58a8733526a240428e35d933947d0027a00d918e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=A1vio=20Ramalho?= Date: Tue, 16 May 2017 12:57:23 -0300 Subject: [PATCH] Fix version comparison on zookeeper plugin As it is, the comparison is made between a tuple of strings, which fails for, for example version '3.4.10' >= '3.3.4', as '10' < '4'. This change converts the tuple of strings into a list of integers, and the comparison is made between two list of integers. Change-Id: Iaedb7c0cfa13c918e70a05e6e20de20c05ca764e --- monasca_agent/collector/checks_d/zk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monasca_agent/collector/checks_d/zk.py b/monasca_agent/collector/checks_d/zk.py index f547841a..1a8b491c 100644 --- a/monasca_agent/collector/checks_d/zk.py +++ b/monasca_agent/collector/checks_d/zk.py @@ -20,7 +20,7 @@ Mode: leader Node count: 487 ``` -Tested with Zookeeper versions 3.0.0 to 3.4.5 +Tested with Zookeeper versions 3.0.0 to 3.4.10 """ import re @@ -101,7 +101,7 @@ class Zookeeper(AgentCheck): raise Exception("Could not parse version from stat command output: %s" % start_line) else: version_tuple = match.groups() - has_connections_val = version_tuple >= ('3', '4', '4') + has_connections_val = map(int, version_tuple) >= [3, 4, 4] # Clients: buf.readline() # skip the Clients: header