Make log upload work when installed system hits emergency mode

Summary:
This is to handle cases like #1414904 , where the system boots
to emergency mode. We really need logs to try and debug this.

Test Plan:
Force a test to hit emergency mode somehow (right now
you can just run base_services_start on Rawhide over and over
until you hit #1414904, but there's probably an easier way to
do it, I think there's a systemd boot arg to tell it which target
to boot for e.g.) and check logs get uploaded. Also check this
doesn't break log upload for a 'normal' failure.

Reviewers: garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames

Reviewed By: garretraziel_but_actually_jsedlak_who_uses_stupid_nicknames

Subscribers: tflink

Differential Revision: https://phab.qa.fedoraproject.org/D1103
This commit is contained in:
Adam Williamson 2017-01-31 11:29:59 +01:00
parent e5dc67126d
commit 186678e98b
4 changed files with 31 additions and 4 deletions

View File

@ -23,10 +23,21 @@ sub root_console {
sub post_fail_hook {
my $self = shift;
$self->root_console(tty=>6);
if (check_screen 'emergency_rescue', 3) {
my $password = get_var("ROOT_PASSWORD", "weakpassword");
type_string "$password\n";
# bring up network so we can upload logs
assert_script_run "dhclient";
}
else {
$self->root_console(tty=>6);
}
# We can't rely on tar being in minimal installs
assert_script_run "dnf -y install tar", 180;
# We can't rely on tar being in minimal installs, but we also can't
# rely on dnf always working (it fails in emergency mode, not sure
# why), so try it, then check if we have tar
script_run "dnf -y install tar", 180;
assert_script_run "rpm -q tar";
# Note: script_run returns the exit code, so the logic looks weird.
# We're testing that the directory exists and contains something.

View File

@ -0,0 +1,16 @@
{
"properties": [],
"tags": [
"LANGUAGE-english",
"emergency_rescue"
],
"area": [
{
"xpos": 1,
"ypos": 48,
"width": 142,
"height": 16,
"type": "match"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -1,4 +1,4 @@
use base "basetest";
use base "installedtest";
use strict;
use testapi;
use utils;