create fedora base class, factor out console login
ClosedPublic

Authored by adamwill on Jul 22 2015, 12:29 AM.

Details

Summary

Root console in anaconda got broken by RHBZ #1222413 - no
shell on tty2. Decided to clean up console use in general as
part of fixing it.

This creates a class 'fedorabase' and has 'anacondalog' and
'fedoralog' both inherit from it. boot_to_login_screen is
moved there (as it seems appropriate) and it has a new
method, console_login, which basically handles 'get me a
shell on a console': if we're already at one it returns,
if not it'll type the user name and the password *if
necessary* (sometimes it's not) and return once it sees a
prompt. It takes a hash of named parameters for user,
password and 'check', which is whether it should die if it
fails to reach a console or not (some users don't want it
to).

anacondalog and fedoralog both get 'root_console' methods
which do something appropriate and then call
console_login; both have a hash of named parameters,
anacondalog's version only bothers with 'check', while
fedoralog's also accepts 'tty' to pick the tty to use.

This also adjusts all things which try to get to a console
prompt to use either root_console or console_login as
appropriate.

It also tweaks the needle tags a bit, drops some unneeded
needles, and adds a new 'user console prompt' needle; we
really just need two versions of the root prompt needle
and two of the user prompt needle (one for <F23, one for
F23+ - the console font changed in F23, and the @ character
at least doesn't match between the two). I think we still
need the <F23 case for upgrade tests, for now.

Test Plan

Do a full test run and see that more tests
succeed. I've done a run on happyassassin with a hack to
workaround the SELinux issue for interactive installs,
and the results look good. I also fiddled about a bit to
test some different cases, like forcing a failure in a
live test to test post_fail_hook (and hence root_console)
in that scenario, and forcing failures after some console
commands had been run to check that it DTRT when we've
already reached a console, etc.

Diff Detail

Repository
rOPENQATESTS os-autoinst-distri-fedora
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
adamwill retitled this revision from to create fedora base class, factor out console login.Jul 22 2015, 12:29 AM
adamwill updated this object.
adamwill edited the test plan for this revision. (Show Details)
adamwill added reviewers: garretraziel, jskladan.

This is an alternative to D460: we take one or the other. I like this more, but do yell if you preferred D460.

adamwill added inline comments.Jul 22 2015, 12:36 AM
tests/_console_wait_login.pm
18

So I should note - I really don't quite get why the original code is set to log in as user then 'su' to root, if both user and root accounts are configured. I don't know if the intent was to test that 'su' works, or what.

We can twiddle this quite easily. If we want to test su for some reason we can actually just run 'su' then call console_login, because console_login actually ought to handle the 'su' password prompt successfully. But for now I just made it so when both user and root accounts are configured it ought to log in as user, then log out (thanks to the $bad check in console_login) and log in again as root, which I guess proves that logging in as both user and root works.

With this plus D456 and a hack to deal with the SELinux bug, 10 of 18 tests pass on the 2015-07-17 nightly. All the kickstart tests fail because of the SELinux bug (my workaround doesn't help the kickstart path). The fedup tests fail I think because I'm missing something in my openQA deployment (the disk images, I guess). multi_empty fails because of a needle issue (the 'two disks' needle is quite fragile as the distance between the disk widgets varies a lot, I'll submit a separate revision for that). The remaining failures:

delete_partial
simple_free_space
software_raid

seem to be actual anaconda bugs. See the most recent runs on https://openqa.happyassassin.net/tests .

garretraziel accepted this revision.Jul 22 2015, 7:15 AM

Looks definitely better than D460.

This revision is now accepted and ready to land.Jul 22 2015, 7:15 AM

Looks very good to me? I don't really remember the reason for the User->Root login sequence, this new way is IMHO much better.

Overall, this is some great work, and if it works, then please feel free to merge!

jskladan accepted this revision.Jul 22 2015, 12:14 PM
adamwill updated this revision to Diff 1232.Jul 22 2015, 6:20 PM

Tweak the console_login loop a bit

I did some more testing and found some issues with the previous
version when doing the 'log in as user then log in as root' thing
and also when lots of tests are running at once (so each step
can take a bit of time). This version works rather better.
Basically I added a couple of vars to make sure we only enter
the username and password once per console_login call, and made
the sleeps a bit longer. There are still ways this can go wrong,
but it's hard to make it much better without making it a lot
messier, I think.

This revision was automatically updated to reflect the committed changes.