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 =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. match the device IP and job action, and may refer to one or more backends.
=cut =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' }, { 'foreign.device' => 'self.device', 'foreign.action' => 'self.action' },
); );

View File

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

View File

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

View File

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