check loadmibs has run before running snapshot
This commit is contained in:
		| @@ -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'); | ||||
| }); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user