introduce noop and refactor checks in all workers

This commit is contained in:
Oliver Gorwits
2017-10-06 07:15:59 +01:00
parent 98463c8cad
commit 3af13f0dfe
26 changed files with 172 additions and 55 deletions

View File

@@ -7,10 +7,13 @@ use aliased 'App::Netdisco::Worker::Status';
use Dancer::Plugin::DBIC 'schema';
register_worker({ stage => 'check' }, sub {
my ($job, $workerconf) = @_;
return Status->error('Missing device (-d).')
unless defined (shift)->device;
return Status->done('ExpireNodes is able to run');
});
return Status->error('nbtstat failed: unable to interpret device param')
if !defined $job->device;
register_worker({ stage => 'main' }, sub {
my ($job, $workerconf) = @_;
schema('netdisco')->txn_do(sub {
schema('netdisco')->resultset('Node')->search({