Module: check_mk
Branch: master
Commit: 30b4231898e7468e4b63dba16b59f4b90d38fb94
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=30b4231898e746…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Aug 24 16:28:43 2011 +0200
Fixed minor layout bug in check man pages
---
.bugs/148 | 10 +++++++---
ChangeLog | 1 +
modules/check_mk.py | 26 ++++++++++++++++++++++----
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/.bugs/148 b/.bugs/148
index 072a7de..6e8d847 100644
--- a/.bugs/148
+++ b/.bugs/148
@@ -1,10 +1,14 @@
Title: cmk -M: nasty white lines in parameters section
Component: core
+State: done
+Class: nastiness
+Date: 2011-02-17 13:47:36
Benefit: 1
-State: open
Cost: 1
-Date: 2011-02-17 13:47:36
-Class: nastiness
+Fun: 0
The the section CHECK PARAMETERS the empty lines between the subsections
must be filled with the background color until the line end.
+
+2011-08-24 16:28:29: changed state open -> done
+Fixed layout algorithm
diff --git a/ChangeLog b/ChangeLog
index b32ea2c..e18efdf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
* Remove 'Agent version (unknown)' for SNMP-only hosts
* Options --version, --help, --man, --list-checks and --packager now
work even with errors in the configuration files
+ * Minor layout fix in check man-pages
Checks & Agents:
* FIX: hr_mem: take into account cache and buffers
diff --git a/modules/check_mk.py b/modules/check_mk.py
index 71e3f62..642449b 100755
--- a/modules/check_mk.py
+++ b/modules/check_mk.py
@@ -2394,7 +2394,8 @@ def get_tty_size():
def all_manuals():
entries = dict([(fn, check_manpages_dir + "/" + fn) for fn in
os.listdir(check_manpages_dir)])
if local_check_manpages_dir and os.path.exists(local_check_manpages_dir):
- entries.update(dict([(fn, local_check_manpages_dir + "/" + fn) for fn
in os.listdir(local_check_manpages_dir)]))
+ entries.update(dict([(fn, local_check_manpages_dir + "/" + fn)
+ for fn in os.listdir(local_check_manpages_dir)]))
return entries
def list_all_manuals():
@@ -2564,6 +2565,21 @@ def show_check_manual(checkname):
netto = re.sub("\033[^m]+m", "", netto)
return len(netto)
+ # only used for debugging
+ def remove_ansi(line):
+ newline = ""
+ ci = 0
+ while ci < len(line):
+ c = line[ci]
+ if c == '\033':
+ while line[ci] != 'm' and ci < len(line):
+ ci += 1
+ else:
+ newline += c
+ ci += 1
+
+ return newline
+
def justify(line, width):
need_spaces = float(width - print_len(line))
spaces = float(line.count(' '))
@@ -2575,7 +2591,7 @@ def show_check_manual(checkname):
for word in words[1:]:
newline += ' '
x += 1.0
- if s/x < need_spaces / spaces:
+ while s/x < need_spaces / spaces:
newline += ' '
s += 1
newline += word
@@ -2595,7 +2611,7 @@ def show_check_manual(checkname):
if word == '<br>':
if line != "":
wrapped.append(fillup(line, width))
- wrapped.append("")
+ wrapped.append(fillup("", width))
line = ""
col = 0
else:
@@ -2645,7 +2661,9 @@ def show_check_manual(checkname):
ags = []
for agent in header['agents'].split(","):
agent = agent.strip()
- ags.append({ "vms" : "VMS",
"linux":"Linux", "aix": "AIX",
"solaris":"Solaris", "windows":"Windows",
"snmp":"SNMP"}.get(agent, agent.upper()))
+ ags.append({ "vms" : "VMS",
"linux":"Linux", "aix": "AIX",
+ "solaris":"Solaris",
"windows":"Windows", "snmp":"SNMP"}
+ .get(agent, agent.upper()))
print_splitline(header_color_left, "Supported Agents: ",
header_color_right, ", ".join(ags))
empty_line()