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

Incorporate running --check into running --start #349

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
2024-??-?? - version 19
- #337 - Add blocker if cPanel is not running version 110
- Use canonical_dump() when building JSON for repo blocker reports
- #348 - Incorporate running --check into running --start

2024-01-09 - version 18
- #332 - Suppress additional checks when run with --check --no-leapp
Expand Down
18 changes: 7 additions & 11 deletions elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ BEGIN { # Suppress load of all of these at earliest point.

sub _build_blockers { [] }

sub check ( $self, %opts ) { # do_check - main entry point
sub check ($self) { # do_check - main entry point

if ( $self->cpev->service->is_active ) {
WARN("An elevation process is already in progress.");
Expand All @@ -261,7 +261,7 @@ BEGIN { # Suppress load of all of these at earliest point.

my $blocker_file = $self->cpev->getopt('check') || ELEVATE_BLOCKER_FILE;

my $has_blockers = $self->_has_blockers( $opts{'dry_run'} );
my $has_blockers = $self->_has_blockers(1);

$self->save( $blocker_file, { 'blockers' => $self->{'blockers'} } );

Expand Down Expand Up @@ -5044,8 +5044,8 @@ sub run ( $pkg, @args ) {
return $self->check_status();
}

return $self->do_cleanup() if $self->getopt('clean');
return $self->blockers->check( 'dry_run' => 1 ) if defined $self->getopt('check');
return $self->do_cleanup() if $self->getopt('clean');
return $self->blockers->check() if defined $self->getopt('check');

my $stage = get_stage();

Expand Down Expand Up @@ -5199,6 +5199,9 @@ sub start ($self) {

}

# Check for blockers before starting the migration
return 1 if ( $self->blockers->check() );

$self->give_last_chance();

system touch => Elevate::Constants::LOG_FILE;
Expand Down Expand Up @@ -5588,13 +5591,6 @@ sub run_stage_1 ($self) {

return 1 unless _sanity_check();

if ( $self->blockers->check() ) {

# we have not yet install the service yet, clear the stage file
$self->service->remove;
return 1;
}

print_box( "Starting stage 1 of " . VALID_STAGES . ": Installing " . $self->service->name . " service" );

# store 'upgrade_to' early so later stages can access it
Expand Down
4 changes: 2 additions & 2 deletions lib/Elevate/Blockers.pm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ our $_CHECK_MODE; # for now global so we can use the helper (move it later to

sub _build_blockers { [] }

sub check ( $self, %opts ) { # do_check - main entry point
sub check ($self) { # do_check - main entry point

if ( $self->cpev->service->is_active ) {
WARN("An elevation process is already in progress.");
Expand All @@ -87,7 +87,7 @@ sub check ( $self, %opts ) { # do_check - main entry point
# If no argument passed to --check, use default path:
my $blocker_file = $self->cpev->getopt('check') || ELEVATE_BLOCKER_FILE;

my $has_blockers = $self->_has_blockers( $opts{'dry_run'} );
my $has_blockers = $self->_has_blockers(1);

$self->save( $blocker_file, { 'blockers' => $self->{'blockers'} } );

Expand Down
14 changes: 5 additions & 9 deletions script/elevate-cpanel.PL
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ sub run ( $pkg, @args ) {
return $self->check_status();
}

return $self->do_cleanup() if $self->getopt('clean');
return $self->blockers->check( 'dry_run' => 1 ) if defined $self->getopt('check');
return $self->do_cleanup() if $self->getopt('clean');
return $self->blockers->check() if defined $self->getopt('check');

my $stage = get_stage();

Expand Down Expand Up @@ -535,6 +535,9 @@ sub start ($self) {

}

# Check for blockers before starting the migration
return 1 if ( $self->blockers->check() );

$self->give_last_chance();

system touch => Elevate::Constants::LOG_FILE;
Expand Down Expand Up @@ -924,13 +927,6 @@ sub run_stage_1 ($self) {

return 1 unless _sanity_check();

if ( $self->blockers->check() ) {

# we have not yet install the service yet, clear the stage file
$self->service->remove;
return 1;
}

print_box( "Starting stage 1 of " . VALID_STAGES . ": Installing " . $self->service->name . " service" );

# store 'upgrade_to' early so later stages can access it
Expand Down