only do device_skip for device jobs
This commit is contained in:
@@ -101,6 +101,7 @@ sub jq_queued {
|
|||||||
sub _get_denied_actions {
|
sub _get_denied_actions {
|
||||||
my $device = shift;
|
my $device = shift;
|
||||||
my @badactions = ();
|
my @badactions = ();
|
||||||
|
return @badactions unless $device;
|
||||||
|
|
||||||
push @badactions, ('discover', @{ setting('job_prio')->{high} })
|
push @badactions, ('discover', @{ setting('job_prio')->{high} })
|
||||||
if not is_discoverable($device);
|
if not is_discoverable($device);
|
||||||
@@ -142,17 +143,19 @@ sub jq_lock {
|
|||||||
$fqdn ||= (hostfqdn || 'localhost');
|
$fqdn ||= (hostfqdn || 'localhost');
|
||||||
my $happy = false;
|
my $happy = false;
|
||||||
|
|
||||||
# need to handle device discovered since backend daemon started
|
if ($job->device) {
|
||||||
# and the skiplist was primed. these should be checked against
|
# need to handle device discovered since backend daemon started
|
||||||
# the various acls and have device_skip entry added if needed,
|
# and the skiplist was primed. these should be checked against
|
||||||
# and return false if it should have been skipped.
|
# the various acls and have device_skip entry added if needed,
|
||||||
my @badactions = _get_denied_actions($job->device);
|
# and return false if it should have been skipped.
|
||||||
if (scalar @badactions) {
|
my @badactions = _get_denied_actions($job->device);
|
||||||
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
|
if (scalar @badactions) {
|
||||||
backend => $fqdn, device => $job->device,
|
schema('netdisco')->resultset('DeviceSkip')->find_or_create({
|
||||||
},{ key => 'device_skip_pkey' })->add_to_actionset(@badactions);
|
backend => $fqdn, device => $job->device,
|
||||||
|
},{ key => 'device_skip_pkey' })->add_to_actionset(@badactions);
|
||||||
|
|
||||||
return false if scalar grep {$_ eq $job->action} @badactions;
|
return false if scalar grep {$_ eq $job->action} @badactions;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# lock db row and update to show job has been picked
|
# lock db row and update to show job has been picked
|
||||||
|
|||||||
Reference in New Issue
Block a user