diff options
-rwxr-xr-x | bin/icli | 22 | ||||
-rw-r--r-- | t/50-icli.t | 2 |
2 files changed, 15 insertions, 9 deletions
@@ -54,27 +54,33 @@ sub read_objects_line { $cache->{$+{key}} = $+{value}; } elsif ($line =~ / ^ \t } $ /x) { - given($context) { - when(['info', 'programstatus']) { + given ($context) { + when (['info', 'programstatus']) { ${$ref}->{$context} = $cache; } - when('hoststatus') { + when ('hoststatus') { ${$ref}->{hosts}->{$cache->{host_name}} = $cache; } - when('servicestatus') { + when ('servicestatus') { push(@{${$ref}->{services}->{$cache->{host_name}}}, $cache); } - when('contactstatus') { + when ('contactstatus') { push(@{${$ref}->{contacts}}, $cache); } - when('hostgroup') { + when ('hostgroup') { ${$ref}->{hostgroups}->{$cache->{hostgroup_name}} = $cache; } - when([qw[timeperiod command contactgroup contact host service]]) { + when ('hostcomment') { + # TODO + } + when ('servicecomment') { + # TODO + } + when ([qw[timeperiod command contactgroup contact host service]]) { # skipped for now } default { - die("Unknown field in $status_file: $context\n"); + warn("Unknown field in $status_file: $context\n"); } } $cache = undef; diff --git a/t/50-icli.t b/t/50-icli.t index 2ab76e4..29702ab 100644 --- a/t/50-icli.t +++ b/t/50-icli.t @@ -110,7 +110,7 @@ $cmd->stderr_is_eq("See perldoc -F bin/icli\n"); $icli = "bin/icli -f t/in/status.dat.weird.1 -c t/in/objects.cache"; $cmd = Test::Command->new(cmd => $icli); -$cmd->exit_isnt_num(0); +$cmd->exit_is_num(0); $cmd->stdout_is_eq($EMPTY); $cmd->stderr_is_eq("Unknown field in t/in/status.dat.weird.1: bork\n"); |