Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/172949
Change subject: Fix bug in MonitoringProtocol._getConfigStringList
......................................................................
Fix bug in MonitoringProtocol._getConfigStringList
This code is designed to verify that `val` is a list of strings:
type(val) == list and reduce(lambda x, y: type(x) == str and y, val)
But it doesn't work correctly if the last element isn't a string (try ['abc',
123], for example) or if the last element is the empty string.
Change-Id: If4d639980c69c2ab0d46a7590f1e8c946f8fcdac
---
M pybal/monitor.py
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/operations/debs/pybal
refs/changes/49/172949/1
diff --git a/pybal/monitor.py b/pybal/monitor.py
index 57c11b3..7a03c63 100644
--- a/pybal/monitor.py
+++ b/pybal/monitor.py
@@ -98,9 +98,9 @@
val = eval(self.configuration[self.__name__.lower() + '.' +
optionname], locals, globals)
if type(val) == str:
return val
- elif type(val) == list and reduce(lambda x, y: type(x) == str and y,
val):
+ elif type(val) == list and all(isinstance(x, str) for x in val):
# Checked that each list member is a string
return val
else:
raise ValueError, "Value of %s is not a string or stringlist" %
optionname
-
\ No newline at end of file
+
--
To view, visit https://gerrit.wikimedia.org/r/172949
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4d639980c69c2ab0d46a7590f1e8c946f8fcdac
Gerrit-PatchSet: 1
Gerrit-Project: operations/debs/pybal
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits