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
This commit is contained in:
Flávio Ramalho 2017-05-16 12:57:23 -03:00
parent 50ca49b7a0
commit 58a8733526
1 changed files with 2 additions and 2 deletions

View File

@ -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