fix(tools): use absolute paths in anvil-get-server-screenshot

main
Tsu-ba-me 3 years ago
parent d3cd671288
commit e14b1fc93e
  1. 6
      Anvil/Tools.pm
  2. 6
      tools/anvil-get-server-screenshot

@ -1083,6 +1083,9 @@ sub _set_paths
'redhat-release' => "/etc/redhat-release",
fences_unified_metadata => "/var/www/html/fences_unified_metadata.xml",
},
devices => {
stdout => "/dev/stdout",
},
directories => {
alert_emails => "/var/spool/anvil",
anvil => "/etc/anvil",
@ -1148,6 +1151,7 @@ sub _set_paths
'anvil-update-states' => "/usr/sbin/anvil-update-states",
'anvil-update-system' => "/usr/sbin/anvil-update-system",
augtool => "/usr/bin/augtool",
base64 => "/usr/bin/base64",
blockdev => "/usr/sbin/blockdev",
bridge => "/usr/sbin/bridge",
bzip2 => "/usr/bin/bzip2",
@ -1224,6 +1228,8 @@ sub _set_paths
ocf_alteeve => "/usr/lib/ocf/resource.d/alteeve/server",
openssl => "/usr/bin/openssl",
'osinfo-query' => "/usr/bin/osinfo-query",
pamscale => "/usr/bin/pamscale",
pamtopng => "/usr/bin/pamtopng",
passwd => "/usr/bin/passwd",
pcs => "/usr/sbin/pcs",
perccli64 => "/opt/MegaRAID/perccli/perccli64",

@ -51,16 +51,16 @@ sub get_server_screenshot
my $server_uuid = $parameters->{server_uuid};
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 = $anvil->data->{path}{exe}{virsh}" --quiet screenshot --domain ".$server_uuid." --file ".$anvil->data->{path}{devices}{stdout};
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 .= " | ".$anvil->data->{path}{exe}{pamscale}." -quiet -xyfit ".$resize_x." ".$resize_y;
}
$shell_call .= " | pamtopng -quiet | base64 --wrap 0";
$shell_call .= " | ".$anvil->data->{path}{exe}{pamtopng}." -quiet | ".$anvil->data->{path}{exe}{base64}." --wrap 0";
my ($shell_output, $shell_return_code) = system_call({ shell_call => $shell_call });

Loading…
Cancel
Save