Make expire_nodes and expire_nodes_archive behave correctly

This commit is contained in:
Oliver Gorwits
2018-01-02 22:04:07 +00:00
parent 24c2c802b8
commit d6ff43a0b3
2 changed files with 14 additions and 11 deletions

View File

@@ -8,6 +8,7 @@
[BUG FIXES] [BUG FIXES]
* Change name of d3 javascript file to force browser reload * Change name of d3 javascript file to force browser reload
* Make expire_nodes and expire_nodes_archive behave correctly
2.038001 - 2018-01-02 2.038001 - 2018-01-02

View File

@@ -109,6 +109,18 @@ sub delete {
return 0E0; return 0E0;
} }
else { else {
foreach my $set (qw/
NodeMonitor
NodeWireless
/) {
$schema->resultset($set)->search(
{ mac => { '-in' => $nodes->as_query }},
)->delete;
}
# now let DBIC do its thing
my @retval = ($self->next::method());
# for node_ip and node_nbt *only* delete if there are no longer # for node_ip and node_nbt *only* delete if there are no longer
# any active nodes referencing the IP or NBT (hence 2nd IN clause). # any active nodes referencing the IP or NBT (hence 2nd IN clause).
foreach my $set (qw/ foreach my $set (qw/
@@ -132,17 +144,7 @@ sub delete {
})->delete; })->delete;
} }
foreach my $set (qw/ return (wantarray ? @retval : $retval[0]);
NodeMonitor
NodeWireless
/) {
$schema->resultset($set)->search(
{ mac => { '-in' => $nodes->as_query }},
)->delete;
}
# now let DBIC do its thing
return $self->next::method();
} }
} }