From afd13620b47118fa4e6f2f2700fc7e2aea65c6ba Mon Sep 17 00:00:00 2001 From: Marius Kittler Date: Tue, 16 Feb 2021 18:24:44 +0100 Subject: [PATCH] Avoid Perl warning when client.conf contains unknown value --- lib/OpenQA/UserAgent.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/OpenQA/UserAgent.pm b/lib/OpenQA/UserAgent.pm index 177fee7244e..e7493f96a94 100644 --- a/lib/OpenQA/UserAgent.pm +++ b/lib/OpenQA/UserAgent.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2018 SUSE LLC +# Copyright (C) 2018-2021 SUSE LLC # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -43,7 +43,9 @@ sub new { for my $i (qw(key secret)) { my $attr = "api$i"; next if $self->$attr; - (my $val = $cfg->val($args{api}, $i)) =~ s/\s+$//; # remove trailing whitespace + my $val = $cfg->val($args{api}, $i); + next unless $val; + $val =~ s/\s+$//; # remove trailing whitespace $self->$attr($val); } last;