diff options
author | Daniel Friesel <derf@finalrewind.org> | 2012-11-20 07:50:38 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2012-11-20 07:55:27 +0100 |
commit | 97a87ad29c99561f12b761d504fe9f14ebabe3a2 (patch) | |
tree | 8adbbd32080df7d5d7e63e15189697cf08f3a79e /bin/icli | |
parent | 0836fe5cb434fb285b1034958bfc47ad433e237c (diff) |
{host,service}_state: do not pass values, just pass hashref
Diffstat (limited to 'bin/icli')
-rwxr-xr-x | bin/icli | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -417,7 +417,9 @@ sub enhance_status { } sub service_state { - my ( $checked, $digit ) = @_; + my ($s) = @_; + my $checked = $s->{has_been_checked}; + my $digit = $s->{current_state}; if ( not $checked ) { return 'PENDING '; @@ -433,7 +435,9 @@ sub service_state { } sub host_state { - my ( $checked, $digit ) = @_; + my ( $h ) = @_; + my $checked = $h->{has_been_checked}; + my $digit = $h->{current_state}; if ( not $checked ) { return ' PENDING '; @@ -516,9 +520,7 @@ sub display_x_verbose { printf( "%-16s : %s (for %s)%s\n", 'Status', - service_state( - $x->{'has_been_checked'}, $x->{'current_state'} - ), + service_state($x), pretty_duration( $x->{'last_state_change'} ), ( $x->{'problem_has_been_acknowledged'} @@ -531,7 +533,7 @@ sub display_x_verbose { printf( "%-16s : %s (for %s)%s\n", 'Status', - host_state( $x->{'has_been_checked'}, $x->{'current_state'} ), + host_state( $x ), pretty_duration( $x->{'last_state_change'} ), ( $x->{'problem_has_been_acknowledged'} @@ -669,7 +671,7 @@ sub display_service { } printf( ' %s', - service_state( $s->{'has_been_checked'}, $s->{'current_state'} ) ); + service_state( $s) ); if ( $v >= 2 ) { printf( ' %d/%d', $s->{'current_attempt'}, $s->{'max_attempts'} ); @@ -735,7 +737,7 @@ sub display_host_single { printf( '%-32.32s %s', $h->{host_name}, - host_state( $h->{'has_been_checked'}, $h->{'current_state'} ) ); + host_state( $h ) ); if ( $v >= 2 ) { printf( ' %d/%d', $h->{'current_attempt'}, $h->{'max_attempts'} ); @@ -779,7 +781,7 @@ sub display_host_overview { printf('%-32.32s %s', $h->{host_name}, - host_state($h->{has_been_checked}, $h->{current_state} ) ); + host_state($h ) ); printf(' %s %s %s %s', pretty_state($ok, 'ok'), |