check loadmibs has run before running snapshot

This commit is contained in:
Oliver Gorwits
2023-08-11 13:29:10 +01:00
parent 5efcdd7707
commit f01f03caa4

View File

@@ -1,6 +1,7 @@
package App::Netdisco::Worker::Plugin::Snapshot;
use Dancer ':syntax';
use Dancer::Plugin::DBIC;
use App::Netdisco::Worker::Plugin;
use aliased 'App::Netdisco::Worker::Status';
@@ -20,6 +21,10 @@ use File::Path 'make_path';
register_worker({ phase => 'check' }, sub {
return Status->error('Missing device (-d).')
unless defined shift->device;
return Status->info("snapshot skipped: please run a loadmibs job first")
unless schema('netdisco')->resultset('SNMPObject')->count();
return Status->done('Snapshot is able to run');
});