fix(plugin): commvault commserve rest api - destClientName attribute not always present (#2753)

Fix #2730
This commit is contained in:
qgarnier 2021-04-30 08:53:44 +02:00 committed by GitHub
parent 7e308b0248
commit 812f195d56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -174,8 +174,9 @@ sub manage_selection {
next if (defined($jobs_checked->{ $job->{jobId} }));
$jobs_checked->{ $job->{jobId} } = 1;
my $policy_name = defined($job->{storagePolicy}->{storagePolicyName}) && $job->{storagePolicy}->{storagePolicyName} ne '' ? $job->{storagePolicy}->{storagePolicyName} : 'unknown';
my $policy_id = defined($job->{storagePolicy}->{storagePolicyId}) && $job->{storagePolicy}->{storagePolicyId} ne '' ? $job->{storagePolicy}->{storagePolicyId} : 'unknown';
my $policy_name = defined($job->{storagePolicy}->{storagePolicyName}) && $job->{storagePolicy}->{storagePolicyName} ne '' ? $job->{storagePolicy}->{storagePolicyName} : 'notAvailable';
my $policy_id = defined($job->{storagePolicy}->{storagePolicyId}) && $job->{storagePolicy}->{storagePolicyId} ne '' ? $job->{storagePolicy}->{storagePolicyId} : 'notAvailable';
my $dest_client_name = defined($job->{destClientName}) ? $job->{destClientName} : 'notAvailable';
# when the job is running, end_time = 0
if (defined($self->{option_results}->{filter_policy_name}) && $self->{option_results}->{filter_policy_name} ne '' &&
@ -194,7 +195,7 @@ sub manage_selection {
next;
}
if (defined($self->{option_results}->{filter_client_name}) && $self->{option_results}->{filter_client_name} ne '' &&
$job->{destClientName} !~ /$self->{option_results}->{filter_client_name}/) {
$dest_client_name !~ /$self->{option_results}->{filter_client_name}/) {
$self->{output}->output_add(long_msg => "skipping job '" . $policy_name . "/" . $job->{jobId} . "': no matching filter type.", debug => 1);
next;
}