move nbtstat and nbtwalk to worker plugins

This commit is contained in:
Oliver Gorwits
2017-09-09 14:46:00 +01:00
parent e7508a9eca
commit 271ef1a25c
7 changed files with 133 additions and 83 deletions

View File

@@ -0,0 +1,21 @@
package App::Netdisco::Worker::Plugin::Nbtstat;
use Dancer ':syntax';
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
use App::Netdisco::Util::Device 'is_macsuckable';
register_worker({ primary => true }, sub {
my ($job, $workerconf) = @_;
return Status->error('nbtstat failed: unable to interpret device param')
if !defined $job->device;
return Status->defer(sprintf 'nbtstat deferred: %s is not macsuckable', $job->device->ip)
unless is_macsuckable($job->device);
return Status->done('Nbtstat is able to run.');
});
true;