add config for scheduled tasks

This commit is contained in:
Oliver Gorwits
2013-03-26 22:42:16 +00:00
parent 2f6efcb312
commit 48f779a8d0
3 changed files with 32 additions and 8 deletions

View File

@@ -8,7 +8,7 @@ use Role::Tiny;
use namespace::clean;
# add dispatch methods for poller tasks
with 'App::Netdisco::Daemon::Worker::Poller::Discover';
# with 'App::Netdisco::Daemon::Worker::Poller::Discover';
sub worker_body {
my $self = shift;

View File

@@ -31,10 +31,10 @@ sub worker_begin {
my $config = setting('housekeeping')->{$a};
# accept either single crontab format, or individual time fields
my $cron = Algorithm::Cron->new(@{
ref [] eq ref $config->{when}
my $cron = Algorithm::Cron->new(%{
ref {} eq ref $config->{when}
? $config->{when}
: [crontab => $config->{when}];
: {crontab => $config->{when}}
});
$jobactions->{$a} = $config;
@@ -71,7 +71,7 @@ sub worker_body {
schema('netdisco')->resultset('Admin')->create({
action => $a,
device => ($sched->{device} || undef),
subaction => ($sched->{extra} || undef),
subaction => ($sched->{param} || undef),
status => 'queued',
});
};