Skip to content

Commit

Permalink
Merge pull request #457 from cPholloway/RE-475
Browse files Browse the repository at this point in the history
Teach wait_for_leapp_completion() about the no-leapp option
  • Loading branch information
toddr authored Jun 24, 2024
2 parents 5a4135e + 50ca328 commit a2d14ec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -6081,6 +6081,9 @@ EOS
}

sub wait_for_leapp_completion ($self) {

return 1 unless $self->cpev->should_run_leapp();

my $upgrade_log = LEAPP_UPGRADE_LOG;

if ( !-e $upgrade_log ) {
Expand Down
4 changes: 4 additions & 0 deletions lib/Elevate/Leapp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ sub extract_error_block_from_output ( $self, $text_ar ) {
# Returns 0 on failure.

sub wait_for_leapp_completion ($self) {

# No use waiting for leapp to complete if we did not run leapp
return 1 unless $self->cpev->should_run_leapp();

my $upgrade_log = LEAPP_UPGRADE_LOG;

if ( !-e $upgrade_log ) {
Expand Down
10 changes: 10 additions & 0 deletions t/leapp_upgrade.t
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@ note 'LEAPP upgrade log failure checks';
{
$mock_leapp_upgrade_log->unlink;

$mock_elevate->redefine(
should_run_leapp => 0,
);

is( cpev->leapp->wait_for_leapp_completion, 1, 'wait_for_leapp_completion returns early when it should NOT run leapp' );

$mock_elevate->redefine(
should_run_leapp => 1,
);

is( cpev->leapp->wait_for_leapp_completion, 0, "wait_for_leapp_completion fails when the upgrade log is missing." );

$mock_leapp_upgrade_log->contents("magic string is missing");
Expand Down

0 comments on commit a2d14ec

Please sign in to comment.