$job->device is always a DBIC row
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package App::Netdisco::Backend::Job;
|
package App::Netdisco::Backend::Job;
|
||||||
|
|
||||||
|
use App::Netdisco::Util::Device 'get_device';
|
||||||
|
|
||||||
use Moo;
|
use Moo;
|
||||||
use namespace::clean;
|
use namespace::clean;
|
||||||
|
|
||||||
@@ -24,6 +26,18 @@ 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 ref $params->{device}) {
|
||||||
|
$params->{device} = get_device( $params->{device} );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $class->$orig(@args);
|
||||||
|
};
|
||||||
|
|
||||||
=head1 METHODS
|
=head1 METHODS
|
||||||
|
|
||||||
=head2 summary
|
=head2 summary
|
||||||
|
|||||||
Reference in New Issue
Block a user