change from ignore to skip name

This commit is contained in:
Oliver Gorwits
2017-05-21 22:35:38 +01:00
parent ed193356f8
commit cf8589aba2
4 changed files with 10 additions and 10 deletions

View File

@@ -116,14 +116,14 @@ sub finished_stamp { return (shift)->get_column('finished_stamp') }
=head1 RELATIONSHIPS
=head2 ignored
=head2 skipped
Retuns the set of C<device_ignore> entries which may apply to this job. They
Retuns the set of C<device_skip> entries which may apply to this job. They
match the device IP and job action, and may refer to one or more backends.
=cut
__PACKAGE__->has_many( ignored => 'App::Netdisco::DB::Result::DeviceIgnore',
__PACKAGE__->has_many( skipped => 'App::Netdisco::DB::Result::DeviceSkip',
{ 'foreign.device' => 'self.device', 'foreign.action' => 'self.action' },
);

View File

@@ -1,11 +1,11 @@
use utf8;
package App::Netdisco::DB::Result::DeviceIgnore;
package App::Netdisco::DB::Result::DeviceSkip;
use strict;
use warnings;
use base 'DBIx::Class::Core';
__PACKAGE__->table("device_ignore");
__PACKAGE__->table("device_skip");
__PACKAGE__->add_columns(
"backend",
{ data_type => "text", is_nullable => 0 },
@@ -15,7 +15,7 @@ __PACKAGE__->add_columns(
{ data_type => "text", is_nullable => 0 },
"failures",
{ data_type => "integer", is_nullable => 1, default_value => '0' },
"ignore",
"skipover",
{ data_type => "boolean", is_nullable => 1, default_value => \'false' },
);
__PACKAGE__->set_primary_key("backend", "device", "action");

View File

@@ -35,9 +35,9 @@ sub _getsome {
my $rs = $jobs->search({
status => 'queued',
device => { '-not_in' => $jobs->correlate('ignored')->search({
device => { '-not_in' => $jobs->correlate('skipped')->search({
backend => $fqdn,
-or => [{ failures => { '>=', 10 } },{ '-bool' => 'ignore' }],
-or => [{ failures => { '>=', 10 } },{ '-bool' => 'skipover' }],
}, { columns => 'device' })->as_query },
%$where,
}, { order_by => 'random()', rows => $num_slots });

View File

@@ -1,11 +1,11 @@
BEGIN;
CREATE TABLE "device_ignore" (
CREATE TABLE "device_skip" (
"backend" text NOT NULL,
"device" inet NOT NULL,
"action" text NOT NULL,
"failures" integer DEFAULT 0,
"ignore" boolean DEFAULT false,
"skipover" boolean DEFAULT false,
PRIMARY KEY ("backend", "device", "action")
);