diff --git a/lib/App/Netdisco/Backend/Job.pm b/lib/App/Netdisco/Backend/Job.pm index d854bb29..a5b21e1a 100644 --- a/lib/App/Netdisco/Backend/Job.pm +++ b/lib/App/Netdisco/Backend/Job.pm @@ -1,7 +1,5 @@ package App::Netdisco::Backend::Job; -use App::Netdisco::Util::Device 'get_device'; - use Moo; use namespace::clean; @@ -26,18 +24,6 @@ foreach my $slot (qw/ ); } -# $job->device is always a DBIC row -around BUILDARGS => sub { - my ( $orig, $class, @args ) = @_; - my $params = $args[0] or return $class->$orig(@args); - - if ((ref {} eq ref $params) and $params->{device}) { - $params->{device} = get_device( $params->{device} ); - } - - return $class->$orig(@args); -}; - =head1 METHODS =head2 summary diff --git a/lib/App/Netdisco/Worker/Runner.pm b/lib/App/Netdisco/Worker/Runner.pm index e154f6a3..6ba1bae2 100644 --- a/lib/App/Netdisco/Worker/Runner.pm +++ b/lib/App/Netdisco/Worker/Runner.pm @@ -5,6 +5,7 @@ use Dancer::Factory::Hook; use aliased 'App::Netdisco::Worker::Status'; use App::Netdisco::Util::Permission qw/check_acl_no check_acl_only/; +use App::Netdisco::Util::Device 'get_device'; use Try::Tiny; use Moo::Role; @@ -28,6 +29,7 @@ sub run { unless ref $job eq 'App::Netdisco::Backend::Job'; $self->job($job); + $self->job->device( get_device($job->device) ); $self->jobstat( Status->error('failed in job init') ); my $action = $job->action;