From c5f138fe624cfcb8de3d7e3f0fa0dbbb60c34874 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 11 Nov 2017 14:43:53 +0000 Subject: [PATCH] correct algorithm on finalise status, correct logging --- lib/App/Netdisco/Backend/Job.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/App/Netdisco/Backend/Job.pm b/lib/App/Netdisco/Backend/Job.pm index 7009c6cd..61c9de8f 100644 --- a/lib/App/Netdisco/Backend/Job.pm +++ b/lib/App/Netdisco/Backend/Job.pm @@ -55,8 +55,9 @@ sub summary { Find the best status and log it into the job's C and C slots. -The process is to track back from the last worker, ignoring user workers, and -find the best status (out of done, defer, error) within the last phase run. +The process is to track back from the last worker and find the best status, +which is C in early or main phases, or else any status in any non-user +phase. =cut @@ -68,15 +69,14 @@ sub finalise_status { $job->status('error'); $job->log('failed to report from any worker!'); - my $phase = undef; my $max_level = Status->error()->level; foreach my $status (reverse @{ $job->_statuslist }) { next unless $status->phase and $status->phase =~ m/^(?:check|early|main)$/; - $phase ||= $status->phase; - last if $status->phase ne $phase; + next if $status->phase eq 'check' + and $status->level eq Status->done()->level; if ($status->level > $max_level) { $job->status( $status->status ); @@ -156,7 +156,9 @@ sub add_status { return unless ref $status eq 'App::Netdisco::Worker::Status'; $status->phase( $job->_current_phase ); push @{ $job->_statuslist }, $status; - debug $status->log if $status->log; + debug $status->log if $status->log + and (($status->phase eq 'check') + or ($status->level ne Status->done()->level)); } =head1 ADDITIONAL COLUMNS