Skip to content

Commit f1584c7

Browse files
committed
striker-collect-debug: disable screenshot collection by default
Closes: #620 Signed-off-by: Fabio M. Di Nitto <[email protected]>
1 parent 510af7e commit f1584c7

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

man/striker-collect-debug.8

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ This restricts the data to be collected to the Striker dashboards and the specif
3535
.TP
3636
This can be used to specify which specific hosts data is collected from. Note that this can be used in conjuction with \fB\-\-anvil\fR to add additional hosts to collect data from, like DR hosts.
3737
.TP
38+
\fB\-\-with\-screenshots\fR
39+
.TP
40+
This collects VMs screenshots together with debug log. Disabled by default.
41+
.TP
3842
\fB\-\-output\-file\fR </path/to/file.tar.bz2>
3943
.TP
4044
This allows you to specify the output compressed tarball that the files will be saved in. By default, the output file is \fB/root/anvil-debug_<timestamp>.tar.bz2\fR. If this is a directory (ending in \fB/\fR), the normal file name is created, just in a different directory. If the path ends in a file that doesn't have the \fB.tar.bz2\fR suffix, that suffix will be added automatically. The output file will always be a bzip2's tarball.

tools/striker-collect-debug

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ my $anvil = Anvil::Tools->new();
3636
$anvil->Get->switches({list => [
3737
"anvil",
3838
"hosts",
39+
"with-screenshots",
3940
"output-file"], man => $THIS_FILE});
4041
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => $anvil->data->{switches}});
4142
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }});
@@ -697,33 +698,40 @@ sub collect_local_data
697698
}
698699
print "Done!\n";
699700

700-
# Grab screenshots.
701-
print "- Collecting server screenshots... ";
702-
if (-d $anvil->data->{path}{directories}{screenshots})
701+
if ($anvil->data->{switches}{'with-screenshots'})
703702
{
704-
$shell_call = $anvil->data->{path}{exe}{tar}." -cvjf ".$target_directory."/server-screenshots.bz2 ".$anvil->data->{path}{directories}{screenshots};
705-
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
706-
707-
($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
708-
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
709-
output => $output,
710-
return_code => $return_code,
711-
}});
712-
if ($return_code)
703+
# Grab screenshots.
704+
print "- Collecting server screenshots... ";
705+
if (-d $anvil->data->{path}{directories}{screenshots})
713706
{
714-
# Failed
715-
print "Failed!\n";
716-
print "Expected the return code '0', but got: [".$return_code."]. The error, if any, was:\n";
717-
print "========\n";
718-
print $output."\n";
719-
print "========\n";
720-
$anvil->nice_exit({exit_code => 1});
707+
$shell_call = $anvil->data->{path}{exe}{tar}." -cvjf ".$target_directory."/server-screenshots.bz2 ".$anvil->data->{path}{directories}{screenshots};
708+
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
709+
710+
($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
711+
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
712+
output => $output,
713+
return_code => $return_code,
714+
}});
715+
if ($return_code)
716+
{
717+
# Failed
718+
print "Failed!\n";
719+
print "Expected the return code '0', but got: [".$return_code."]. The error, if any, was:\n";
720+
print "========\n";
721+
print $output."\n";
722+
print "========\n";
723+
$anvil->nice_exit({exit_code => 1});
724+
}
725+
print "Done!\n";
726+
}
727+
else
728+
{
729+
print "Failed!\nScreenshot directory: [".$anvil->data->{path}{directories}{screenshots}."] doesn't exist, skipping.\n";
721730
}
722-
print "Done!\n";
723731
}
724732
else
725733
{
726-
print "Failed!\nScreenshot directory: [".$anvil->data->{path}{directories}{screenshots}."] doesn't exist, skipping.\n";
734+
print "- Screehshots collection disabled.\n";
727735
}
728736
}
729737

0 commit comments

Comments
 (0)