From: Stephen Soltesz Date: Mon, 5 Nov 2007 22:32:19 +0000 (+0000) Subject: Allow queries using sitefilter regular expressions, rather than a single X-Git-Tag: Monitor-1.0-0~40 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c1cdc2dc48f47382c0c7329886598dd1e6bbed1a;p=monitor.git Allow queries using sitefilter regular expressions, rather than a single loginbase. Allows displaying common sites like 'cernet*'. --- diff --git a/www/printbadnodes.py b/www/printbadnodes.py index ea355fe..95bddf4 100755 --- a/www/printbadnodes.py +++ b/www/printbadnodes.py @@ -258,6 +258,11 @@ def main(sitefilter): # d2 was an array of [{node}, {}, ...] # the bysite is a loginbase dict of [{node}, {node}] d2 = [] + import re + if sitefilter != None: + sf = re.compile(sitefilter) + else: + sf = None for nodename in l_nodes: vals=d_n[nodename]['values'] v = {} @@ -283,7 +288,7 @@ def main(sitefilter): v['site_string'] = site_string v['loginbase'] = loginbase - if (sitefilter != None and loginbase == sitefilter) or sitefilter == None: + if (sitefilter != None and sf.match(loginbase) != None) or sitefilter == None: d2.append(v)