Updated striker-get-screenshots to set permissions properly.

This updates the /opt/alteeve/screenshot directories and the screenshots
in them to be readible by the WebUI.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 55b1380031
commit 68521cdab7
  1. 1
      Anvil/Tools.pm
  2. 2
      tools/anvil-join-anvil
  3. 42
      tools/striker-get-screenshots

@ -1115,6 +1115,7 @@ sub _set_paths
ifcfg => "/etc/sysconfig/network-scripts", ifcfg => "/etc/sysconfig/network-scripts",
journald => "/var/log/journal", journald => "/var/log/journal",
libvirtd_definitions => "/etc/libvirt/qemu/", libvirtd_definitions => "/etc/libvirt/qemu/",
opt_alteeve => "/opt/alteeve",
pgsql => "/var/lib/pgsql/", pgsql => "/var/lib/pgsql/",
resource_status => "/sys/kernel/debug/drbd/resources", resource_status => "/sys/kernel/debug/drbd/resources",
scan_agents => "/usr/sbin/scancore-agents", scan_agents => "/usr/sbin/scancore-agents",

@ -298,7 +298,7 @@ sub configure_pacemaker
my $both_online = 0; my $both_online = 0;
until($both_online) until($both_online)
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
'path::configs::corosync.conf' => $anvil->data->{path}{configs}{'corosync.conf'}, 'path::configs::corosync.conf' => $anvil->data->{path}{configs}{'corosync.conf'},
}}); }});
if (-e $anvil->data->{path}{configs}{'corosync.conf'}) if (-e $anvil->data->{path}{configs}{'corosync.conf'})

@ -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?

Loading…
Cancel
Save