@ -42,6 +42,9 @@ if ($anvil->data->{switches}{'job-uuid'})
$anvil->data->{job}{progress} = 1;
$anvil->data->{job}{progress} = 1;
# Make sure the directory we write screenshots to exists and has the proper ownership and mode.
check_screenshot_directory($anvil);
# Which subnodes are up?
# Which subnodes are up?
$anvil->Database->get_hosts();
$anvil->Database->get_hosts();
$anvil->Database->get_dr_links();
$anvil->Database->get_dr_links();
@ -178,6 +181,29 @@ $anvil->nice_exit({exit_code => 0});
# Functions #
# Functions #
#############################################################################################################
#############################################################################################################
sub check_screenshot_directory
{
my ($anvil) = @_;
foreach my $directory ($anvil->data->{path}{directories}{opt_alteeve}, $anvil->data->{path}{directories}{screenshots})
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { directory => $directory }});
$anvil->Storage->change_owner({
debug => 2,
path => $directory,
user => "striker-ui-api",
group => "striker-ui-api",
});
$anvil->Storage->change_mode({
debug => 2,
path => $directory,
mode => "0755",
});
}
return(0);
}
sub remove_old_screenshots
sub remove_old_screenshots
{
{
my ($anvil) = @_;
my ($anvil) = @_;
@ -411,6 +437,14 @@ sub get_screenshots
'format' => "jpeg",
'format' => "jpeg",
},
},
});
});
# Change the ownership
$anvil->Storage->change_owner({
debug => 2,
path => $jpg_file,
user => "striker-ui-api",
group => "striker-ui-api",
});
}
}
# Convert to png
# Convert to png
@ -438,6 +472,14 @@ sub get_screenshots
'format' => "png",
'format' => "png",
},
},
});
});
# Change the ownership
$anvil->Storage->change_owner({
debug => 2,
path => $png_file,
user => "striker-ui-api",
group => "striker-ui-api",
});
}
}
# Delete the original PPM file?
# Delete the original PPM file?