fix(veeam): patch edge case on empty JSON with Veeam tape-jobs mode (#3280)

This commit is contained in:
Simon Bomm 2021-11-26 15:54:13 +01:00 committed by GitHub
parent fb5e0e5be1
commit 303dd5c3e2
1 changed files with 10 additions and 0 deletions

View File

@ -161,6 +161,11 @@ sub manage_selection {
$self->{output}->output_add(long_msg => "skipping job '" . $job->{name} . "': no matching filter type.", debug => 1);
next;
}
# Sometimes we may get such JSON: [{"lastResult":null,"name":null,"lastState":null,"type":null,"enabled":null}]
if (!defined($job->{name})) {
$self->{output}->output_add(long_msg => "skipping nulled job (empty json)", debug => 1);
next;
}
$self->{job}->{ $job->{name} } = {
display => $job->{name},
@ -170,6 +175,11 @@ sub manage_selection {
last_state => $job_tape_state->{ $job->{lastState} }
};
$self->{global}->{total}++;
if (scalar(keys %{$self->{job}}) <= 0) {
$self->{output}->add_option_msg(short_msg => "No tape jobs found. Review filters. More infos with --debug option");
$self->{output}->option_exit();
}
}
}