#227 Do not overwrite partially retrieved data with null or incorrect values
this and two related commits implements: - setting snmp_field_protection which can be used to protect any database field from having a null value set - extra device discover worker which prefetches SNMP interfaces and performs some sanity checks and comparison against the DB the two checks will return job status ERROR with CANCELLED if they see anything fishy.
This commit is contained in:
@@ -93,6 +93,8 @@ sub best_status {
|
||||
my $cur_level = 0;
|
||||
my $cur_status = '';
|
||||
|
||||
return Status->error()->status if $job->is_cancelled;
|
||||
|
||||
foreach my $status (reverse @{ $job->_statuslist }) {
|
||||
next if $status->phase
|
||||
and $status->phase !~ m/^(?:early|main|store|late)$/;
|
||||
@@ -122,6 +124,12 @@ sub finalise_status {
|
||||
|
||||
my $max_level = Status->error()->level;
|
||||
|
||||
if ($job->is_cancelled and scalar @{ $job->_statuslist }) {
|
||||
$job->status( $job->_statuslist->[-1]->status );
|
||||
$job->log( $job->_statuslist->[-1]->log );
|
||||
return;
|
||||
}
|
||||
|
||||
foreach my $status (reverse @{ $job->_statuslist }) {
|
||||
next if $status->phase
|
||||
and $status->phase !~ m/^(?:check|early|main|store|late)$/;
|
||||
|
||||
@@ -233,7 +233,7 @@ snmpretries: 2
|
||||
snmp_remoteport: {}
|
||||
snmp_field_protection:
|
||||
device:
|
||||
serial: ['any']
|
||||
serial: ['group:__ANY__']
|
||||
devices_no: []
|
||||
devices_only: []
|
||||
discover_no: []
|
||||
|
||||
Reference in New Issue
Block a user