From 591f6cd01893fd9bb3bc4d0ce36bc255121dfdbc Mon Sep 17 00:00:00 2001 From: "Jose D. Gomez R" <1josegomezr@gmail.com> Date: Thu, 16 Nov 2023 14:36:37 +0100 Subject: [PATCH] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Martchus Co-authored-by: Tina Müller (tinita) --- lib/OpenQA/WebAPI/Plugin/ObsRsync.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/OpenQA/WebAPI/Plugin/ObsRsync.pm b/lib/OpenQA/WebAPI/Plugin/ObsRsync.pm index 86d099c20820..86c86b4457e6 100644 --- a/lib/OpenQA/WebAPI/Plugin/ObsRsync.pm +++ b/lib/OpenQA/WebAPI/Plugin/ObsRsync.pm @@ -535,9 +535,9 @@ sub _for_every_batch { # Based on https://www.suse.com/c/multi-factor-authentication-on-suses-build-service/ sub _bs_ssh_sign ($key, $realm, $value) { - die "SSH Key File not found at $key" unless (-e $key || -z $key); + die "SSH key file not found at $key" unless -s $key; # This needs to be a bit portable for CI testing - my $tmp = Mojo::File::tempfile->spew($value); + my $tmp = Mojo::File::tempfile('obs-rsync-ssh-keyfile-XXXXX')->spew($value); my @lines = split "\n", qx/ssh-keygen -Y sign -f "$key" -q -n "$realm" < $tmp/; shift @lines; pop @lines;