Module: check_mk
Branch: master
Commit: fcdb0a850041355407e2d6de8bddd7143ebd27f7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=fcdb0a85004135…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Mar 1 15:31:44 2011 +0100
validator: added -c/--checks to limit the checks to validate
---
doc/helpers/validate_checks | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/doc/helpers/validate_checks b/doc/helpers/validate_checks
index e66dd21..e48ac3c 100755
--- a/doc/helpers/validate_checks
+++ b/doc/helpers/validate_checks
@@ -122,11 +122,11 @@ def grep_manpage(check, match, section = None):
def usage(msg = ''):
if msg:
- print msg
- print
+ sys.stderr.write("%s\n" % msg)
+ sys.stderr.write("\n")
for s, l, t in _args:
- print ' %3s, %-15s %s' % (s, l, t)
- print
+ sys.stderr.write(' %3s, --%-15s %s\n' %
('-'+s.rstrip(':'), l, t))
+ sys.stderr.write("\n")
sys.exit(0)
ignored_variables = [
@@ -322,6 +322,7 @@ def verify_perfometer(check):
# #############################################################################
_args = [
+ ('c:', 'checks=', 'Put one or more checks (comma separated)
to limit the checks to validate'),
('l:', 'score-limit=', 'Set an upper score limit. Only checks
with a lower score will be shown'),
('v', 'verbose', 'Enable verbose output'),
('h', 'help', 'Show help message'),
@@ -329,6 +330,7 @@ _args = [
_verbose = 0
_score_limit = None
+_checks = []
try:
opts, args = getopt.getopt(sys.argv[1:], ''.join([ x[0] for x in _args ]), [
x[1] for x in _args ])
except getopt.error, msg:
@@ -338,13 +340,20 @@ for o, a in opts:
_verbose += 1
elif o in ('-l', '--score-limit'):
_score_limit = int(a)
+ elif o in ('-c', '--checks'):
+ _checks = a.split(',')
elif o in ('-h', '--help'):
usage()
+ else:
+ usage('Unhandled parameter: %s' % str(o))
# 1) Perform checks
#
results = {}
for check in get_all_checks():
+ if _checks and not check in _checks:
+ continue
+
score = SCORE_START
check_results = TESTS.copy()