summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-07-28 13:50:08 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-07-28 13:50:08 +0200
commitaee0c6e34baa71f02f0e81a430f67f3d7ae54f31 (patch)
tree48540751c290479022d6a1b64352160c334efed2 /bin
parent8cc414e9425cce5088b27d8e491a407bd50f9a75 (diff)
More tests. 100% total code coverage :)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/icli13
1 files changed, 8 insertions, 5 deletions
diff --git a/bin/icli b/bin/icli
index 19280c7..c5fd4ac 100755
--- a/bin/icli
+++ b/bin/icli
@@ -21,7 +21,7 @@ sub have_host {
if ($list_type eq 's') {
return exists $data->{services}->{$host};
}
- elsif ($list_type eq 'h') {
+ else {
return exists $data->{hosts}->{$host};
}
}
@@ -66,7 +66,7 @@ sub read_objects_line {
# skipped for now
}
default {
- warn("Unknown field in $status_file: $context\n");
+ die("Unknown field in $status_file: $context\n");
}
}
$cache = undef;
@@ -102,7 +102,7 @@ sub service_state {
when(1) { return with_colour(' WARNING', 'black on_yellow') }
when(2) { return with_colour('CRITICAL', 'white on_red' ) }
when(3) { return with_colour(' UNKNOWN', 'white on_blue' ) }
- default { return $digit }
+ default { die("Unknown service state: $digit\n") }
}
}
@@ -112,7 +112,7 @@ sub host_state {
when(0) { return with_colour(' OK ', 'black on_green') }
when(1) { return with_colour(' DOWN ', 'white on_red' ) }
when(2) { return with_colour('UNREACHABLE', 'white on_blue' ) }
- default { return $digit }
+ default { die("Unknown host state: $digit\n") }
}
}
@@ -169,7 +169,7 @@ sub display_host {
if ($list_type eq 'h') {
display_host_single($host);
}
- elsif ($list_type eq 's') {
+ else {
display_host_services($host, $all);
}
}
@@ -222,6 +222,9 @@ elsif ($list_type eq 'h') {
display_host($host, 1);
}
}
+else {
+ die("See perldoc -F $0\n");
+}
__END__