cancel jobs when it is known fresh device is already discovered

This commit is contained in:
Oliver Gorwits
2018-02-11 11:16:14 +00:00
parent 147c02a956
commit d3c83c395d
4 changed files with 34 additions and 7 deletions

View File

@@ -22,6 +22,7 @@ foreach my $slot (qw/
log
device_key
job_priority
is_cancelled
_current_phase
_last_namespace
@@ -45,6 +46,10 @@ sub BUILD {
$job->action($1);
$job->only_namespace($2);
}
if (!defined $job->subaction) {
$job->subaction('');
}
}
=head1 METHODS
@@ -63,6 +68,19 @@ sub display_name {
($job->port || '');
}
=head2 cancel
Log a status and prevent other stages from runnning.
=cut
sub cancel {
my ($job, $msg) = @_;
$msg ||= 'unknown reason for cancelled job';
$job->is_cancelled(true);
return Status->info($msg);
}
=head2 finalise_status
Find the best status and log it into the job's C<status> and C<log> slots.