From a321a3f4044902664b5a036cd0a49a3f555da192 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 18 Jul 2023 03:27:41 -0400 Subject: [PATCH] fix(tools): treat empty tunnel list as no tunnels --- tools/striker-manage-vnc-pipes | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/striker-manage-vnc-pipes b/tools/striker-manage-vnc-pipes index 86e1e856..0df785ed 100755 --- a/tools/striker-manage-vnc-pipes +++ b/tools/striker-manage-vnc-pipes @@ -241,12 +241,16 @@ sub find_tunnels my $debug = $parameters->{debug} || 3; my $tunnel_ls_path = $parameters->{tunnel_ls_path}; - return (1) if ( (not defined $tunnel_ls_path) || (not -e $tunnel_ls_path) ); + $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => $parameters, prefix => "find_tunnels" }); - open(my $tunnel_ls_fh, "< :encoding(UTF-8)", $tunnel_ls_path) or return (1); + return (1) if (not defined $tunnel_ls_path); my $result = { server_uuids => {}, lports => {} }; + return (0, $result) if (not -e $tunnel_ls_path); + + open(my $tunnel_ls_fh, "< :encoding(UTF-8)", $tunnel_ls_path) or return (1); + while (my $line = <$tunnel_ls_fh>) { chomp($line);