Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add post_fail_hook for boot_to_desktop #6370

Merged
merged 1 commit into from Feb 20, 2019

Conversation

DrMullings
Copy link
Contributor

Added a basic post_fail_hook for boot_to_desktop

Opened for discussion what other steps we could introduce here

@DrMullings DrMullings force-pushed the boot_to_desktop_postfail branch 2 times, most recently from ca0c4f2 to 658e4d1 Compare December 7, 2018 14:00

# if we found a shell, we do not need the memory dump
if (!(match_has_tag('emergency-shell') or match_has_tag('emergency-mode'))) {
die "save_memory_dump is temporarily unavailable, see https://progress.opensuse.org/issues/19390";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this die is executed without any condition, the rest of the commands in the if block won't ever get executed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, but this code is from first_boot so we should also change it there

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we should maybe reuse the code.

@Soulofdestiny
Copy link
Contributor

bump

@DrMullings DrMullings changed the title [WIP?] Add post_fail_hook for boot_to_desktop Add post_fail_hook for boot_to_desktop Jan 29, 2019
@DrMullings
Copy link
Contributor Author

Removed dead code

okurz
okurz previously requested changes Jan 29, 2019
tests/boot/boot_to_desktop.pm Outdated Show resolved Hide resolved
tests/boot/boot_to_desktop.pm Outdated Show resolved Hide resolved
tests/boot/boot_to_desktop.pm Outdated Show resolved Hide resolved
tests/boot/boot_to_desktop.pm Outdated Show resolved Hide resolved
@DrMullings DrMullings force-pushed the boot_to_desktop_postfail branch 6 times, most recently from f8f4a05 to 8e666f0 Compare February 1, 2019 09:28
save_memory_dump;
}

# crosscheck for text login on tty1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thought is to check if the system completely fails to boot or just fails booting to the desktop

}

# crosscheck for text login on tty1
select_console 'root-console';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally we use "log-console" because the "root-console" might have some clutter on it preventing it to be usable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since its not the intention to actually use the console this should not make a difference?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I see. So if the login works then we can collect logs otherwise we are lost anyway?

@DrMullings
Copy link
Contributor Author

Closing this in the progress of the discussion and now working on a common base with a proper booting post_fail_hook

@DrMullings
Copy link
Contributor Author

I added a 'bootbasetest' and used it in said modules, please give feedback

@DrMullings DrMullings force-pushed the boot_to_desktop_postfail branch 6 times, most recently from 018d0a0 to d9c163e Compare February 11, 2019 13:46
@okurz
Copy link
Member

okurz commented Feb 17, 2019

looks nice but still please provide a verification run

@DrMullings
Copy link
Contributor Author

Verification run: http://pinky.arch.suse.de/tests/81

Added a baseclass with a generic post_fail_hook for tests that
boot a system

# try to save logs as a last resort
$self->export_logs();
bootbasetest->post_fail_hook();
Copy link
Contributor

@jknphy jknphy Feb 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might want to export the function, although I didn't know that calling directly with -> could work. The other option that I know is bootbasetest::post_fail_hook but it is more used in our shared code the first one I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the hint, I was wondering like an Idiot why it did not work as expected :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm after taking a look at y2logstep and opensusebasetest I wonder if it is needed to export the function, none of those baseclasses do it?

Copy link
Contributor

@jknphy jknphy Feb 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for example here is calling the parent because is overriding the function in base but you use it as utility, not as base. As a base you can also call it sometime with $self, it depends on the case.
As a utility library I would say that you can use this approach to export it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Martchus wdyt?

Copy link
Contributor

@Martchus Martchus Feb 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't export it. That makes accidental calls to that function more likely.

Not sure why the :: syntax doesn't work but -> should be fine, too (since the function does not evaluate any arguments anyways).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative I think you could use multiple inheritance, e.g. use base qw(foo bar)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@okurz I saw the same alternative, and would actually create a ticket or suggest @DrMullings to come with this approach, but the pr has been hanging here for so long... that it started to get sad and feel forgotten...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I already told @foursixnine multiple inheritance sounds like opening the gates to the hell of ambiguity, we should not do it as long as we have a working state

@DrMullings
Copy link
Contributor Author

Are we good to go here?

@foursixnine foursixnine dismissed okurz’s stale review February 20, 2019 22:05

No further comments from @okurz so far

@foursixnine foursixnine merged commit a0baa68 into os-autoinst:master Feb 20, 2019
@foursixnine
Copy link
Member

If it breaks it breaks :) There are few improvements that we can do as a followup for this

@@ -15,6 +15,7 @@

use strict;
use base "y2logsstep";
use bootbasetest;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DrMullings Looking at this again... changing this line to use base "bootbasetest' and moving it above y2logsstep should do the trick too. (use base qw(bootbasetest y2logsstep) should also do the trick and call the post_fail_hook from bootbasetest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants