fix(tools): avoid using undef resize args when getting server screenshot

main
Tsu-ba-me 3 years ago
parent 7b14433588
commit 2c1f400222
  1. 6
      tools/anvil-get-server-screenshot

@ -49,12 +49,14 @@ sub get_server_screenshot
{ {
my $parameters = shift; my $parameters = shift;
my $server_uuid = $parameters->{server_uuid}; my $server_uuid = $parameters->{server_uuid};
my ($resize_x, $resize_y) = split(/x/ , $parameters->{resize_args}); my $resize_args = defined $parameters->{resize_args} ? $parameters->{resize_args} : '';
my $shell_call = "virsh --quiet screenshot --domain ".$server_uuid." --file /dev/stdout"; my $shell_call = "virsh --quiet screenshot --domain ".$server_uuid." --file /dev/stdout";
if ($resize_x =~ /^\d+$/ && $resize_y =~ /^\d+$/) if ($resize_args =~ /^\d+x\d+$/)
{ {
my ($resize_x, $resize_y) = split(/x/ , $resize_args);
$shell_call .= " | pamscale -quiet -xyfit ".$resize_x." ".$resize_y; $shell_call .= " | pamscale -quiet -xyfit ".$resize_x." ".$resize_y;
} }

Loading…
Cancel
Save