only set layer if successful action

This commit is contained in:
Oliver Gorwits
2019-09-01 18:39:22 +01:00
parent b108be5e23
commit a267efa3d8
2 changed files with 17 additions and 21 deletions

View File

@@ -34,10 +34,7 @@ register_worker({ phase => 'store' }, sub {
debug sprintf ' [%s] arpnip - processed %s IPv6 Neighbor Cache entries', debug sprintf ' [%s] arpnip - processed %s IPv6 Neighbor Cache entries',
$device->ip, scalar @{ vars->{'v6arps'} }; $device->ip, scalar @{ vars->{'v6arps'} };
$device->update({ $device->update({last_arpnip => \$now});
last_arpnip => \$now,
layers => \[q{overlay(layers placing '1' from 6 for 1)}],
});
my $status = $job->best_status; my $status = $job->best_status;
return Status->$status("Ended arpnip for $device"); return Status->$status("Ended arpnip for $device");
@@ -58,6 +55,7 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
push @{ vars->{'v6arps'} }, push @{ vars->{'v6arps'} },
@{get_arps_snmp($device, $snmp->ipv6_n2p_mac, $snmp->ipv6_n2p_addr) }; @{get_arps_snmp($device, $snmp->ipv6_n2p_mac, $snmp->ipv6_n2p_addr) };
$device->update({layers => \[q{overlay(layers placing '1' from 6 for 1)}]});
return Status->done("Gathered arp caches from $device"); return Status->done("Gathered arp caches from $device");
}); });
@@ -102,6 +100,7 @@ register_worker({ phase => 'main', driver => 'cli' }, sub {
push @{ vars->{'v6arps'} }, push @{ vars->{'v6arps'} },
grep { NetAddr::IP::Lite->new($_->{ip})->bits == 128 } @arps; grep { NetAddr::IP::Lite->new($_->{ip})->bits == 128 } @arps;
$device->update({layers => \[q{overlay(layers placing '1' from 6 for 1)}]});
return Status->done("Gathered arp caches from $device"); return Status->done("Gathered arp caches from $device");
}); });

View File

@@ -92,10 +92,7 @@ register_worker({ phase => 'main', driver => 'snmp' }, sub {
debug sprintf ' [%s] macsuck - removed %d fwd table entries to archive', debug sprintf ' [%s] macsuck - removed %d fwd table entries to archive',
$device->ip, $archived; $device->ip, $archived;
$device->update({ $device->update({last_macsuck => \$now});
last_macsuck => \$now,
layers => \[q{overlay(layers placing '1' from 7 for 1)}],
});
return Status->done("Ended macsuck for $device"); return Status->done("Ended macsuck for $device");
}); });