mirror of
https://github.com/rocky-linux/os-autoinst-distri-rocky.git
synced 2024-12-22 02:38:31 +00:00
More tweaking for this damn no root password spoke situation
Previous approach wouldn't work for tests that run after the install test...let's just set a password from a chroot after install completes. Don't really like this as it changes the 'real' install process a bit, but it's the least invasive short term fix at least. We can maybe do something more sudo-y later with a bit more thought. Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
parent
83c32fe04e
commit
0915b857f9
@ -65,7 +65,8 @@ it also means that `B` conflicts `A` even if not shown in the table).
|
||||
| `PARTITIONING` | string (`custom_software_raid`, `guided_delete_all`, ...) | `guided_empty` | nothing | load specified test for partitioning part (when `PARTITIONING=guided_delete_all`, `tests/disk_guided_delete_all.pm` is loaded) and optionally post-install partitioning check (if `tests/disk_guided_delete_all_postinstall.pm` exists, it will be loaded after login to the installed system). Also, if value starts with `custom_`, the `select_disks()` method will check the custom partitioning box |
|
||||
| `ENCRYPT_PASSWORD` | string | not set | nothing | if set, encrypt disk with given password |
|
||||
| `DESKTOP` | boolean | `false`/not set | nothing | set to indicate that Fedora is running with GUI (so for example OpenQA should expect graphical login screen) |
|
||||
| `ROOT_PASSWORD` | string | `weakpassword` | nothing | root password is set to this value; special value 'false' means "do not set a root password during installation at all" |
|
||||
| `ROOT_PASSWORD` | string | `weakpassword` | nothing | root password is set to this value |
|
||||
| `INSTALLER_NO_ROOT` | boolean | `false`/not set | nothing | if set, root password is not set via the anaconda spoke (but, for now, will be set by chrooting into the installed system at the end of installation) |
|
||||
| `GRUB` | string | not set | nothing | when set, append this string to kernel line in GRUB |
|
||||
| `GRUBADD` | string | not set | nothing | when set, append this string to kernel line in GRUB, after the `GRUB` string if that one is set too. This is never set by tests; instead it's provided as a way to e.g. run the normal tests with an `updates.img` to test some anaconda change (the scheduler CLI can help you use this feature) |
|
||||
| `USER_LOGIN` | string | not set | should be used with `USER_PASSWORD` (unless `false`) | when set, user login is set to this value. If not set, default value `test` is used for console installs, no login is done for graphical installs. If set to `false`, no user login will be done |
|
||||
|
@ -10,24 +10,14 @@ use testapi;
|
||||
use utils;
|
||||
|
||||
sub root_console {
|
||||
# Switch to a default or specified TTY and log in as root, or
|
||||
# log in as regular user and sudo if no root password.
|
||||
# Switch to a default or specified TTY and log in as root.
|
||||
my $self = shift;
|
||||
my %args = (
|
||||
tty => 1, # what TTY to login to
|
||||
@_);
|
||||
|
||||
send_key "ctrl-alt-f$args{tty}";
|
||||
if (get_var("ROOT_PASSWORD") eq "false") {
|
||||
console_login(user=>get_var("USER_LOGIN", "test"), password=>get_var("USER_PASSWORD", "weakpassword"));
|
||||
type_string "sudo su";
|
||||
type_string get_var("USER_PASSWORD", "weakpassword");
|
||||
send_key "ret";
|
||||
assert_screen "root_console";
|
||||
}
|
||||
else {
|
||||
console_login;
|
||||
}
|
||||
console_login;
|
||||
}
|
||||
|
||||
sub post_fail_hook {
|
||||
|
4
main.pm
4
main.pm
@ -147,9 +147,9 @@ sub load_install_tests() {
|
||||
# try and use them. However we're also still testing F27 live
|
||||
# respins, so we can't just do this in the templates yet, sadly.
|
||||
if (get_var('LIVE') && get_var('DESKTOP') eq 'gnome') {
|
||||
set_var('ROOT_PASSWORD', 'false');
|
||||
set_var('INSTALLER_NO_ROOT', '1');
|
||||
# this is effectively a forced install_no_user
|
||||
set_var('INSTALL_NO_USER', 'false');
|
||||
set_var('INSTALL_NO_USER', '1');
|
||||
}
|
||||
|
||||
if (get_var('ANACONDA_TEXT')) {
|
||||
|
@ -26,10 +26,9 @@ sub run {
|
||||
wait_still_screen 2;
|
||||
assert_and_click "anaconda_main_hub_begin_installation";
|
||||
|
||||
# Set root password, unless ROOT_PASSWORD is 'false' (meaning not
|
||||
# to do this)
|
||||
# Set root password, unless we don't want to or can't
|
||||
my $root_password = get_var("ROOT_PASSWORD") || "weakpassword";
|
||||
unless ($root_password eq 'false') {
|
||||
unless (get_var("INSTALLER_NO_ROOT")) {
|
||||
assert_and_click "anaconda_install_root_password";
|
||||
assert_screen "anaconda_install_root_password_screen";
|
||||
# wait out animation
|
||||
@ -87,6 +86,13 @@ sub run {
|
||||
# reboot from a console, it's more reliable than the desktop
|
||||
# runners
|
||||
$self->root_console;
|
||||
# if we didn't set a root password during install, set it
|
||||
# now...this is kinda icky, but I don't see a great option
|
||||
if (get_var("INSTALLER_NO_ROOT")) {
|
||||
assert_script_run "chroot /mnt/sysimage";
|
||||
assert_script_run "echo $root_password | passwd --stdin root";
|
||||
assert_script_run "exit";
|
||||
}
|
||||
type_string "reboot\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user