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

Teach should_run_leapp to check for the CLI option #340

Merged
merged 1 commit into from
Jan 9, 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
4 changes: 3 additions & 1 deletion elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -6360,7 +6360,9 @@ sub setup_answer_file {
sub should_run_leapp ($self) {

# we store the no_leapp option, but prefer using a positive check instead
my $no_leapp = read_stage_file( 'no_leapp', 0 );
# we need to check to see if the no-leapp option is passed via CLI here too in order
# to allow users to run this script with the '--check --no-leapp' options
my $no_leapp = read_stage_file( 'no_leapp', 0 ) || $self->getopt('no-leapp');
return !$no_leapp;
}

Expand Down
4 changes: 3 additions & 1 deletion script/elevate-cpanel.PL
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,9 @@ sub setup_answer_file {
sub should_run_leapp ($self) {

# we store the no_leapp option, but prefer using a positive check instead
my $no_leapp = read_stage_file( 'no_leapp', 0 );
# we need to check to see if the no-leapp option is passed via CLI here too in order
# to allow users to run this script with the '--check --no-leapp' options
my $no_leapp = read_stage_file( 'no_leapp', 0 ) || $self->getopt('no-leapp');
Copy link
Member

Choose a reason for hiding this comment

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

should we be checking the getopt first prior to going out to disk? I'm wondering if there are gotchas going in this order.

return !$no_leapp;
}

Expand Down
3 changes: 2 additions & 1 deletion t/leapp_upgrade.t
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ $mock_elevate->redefine(
setup_answer_file => sub { # cannot use Test::MockFile with system touch...
note "mocked setup_answer_file";
return;
}
},
getopt => sub { return; },
);

my $mock_elevate_file = Test::MockFile->file('/var/cpanel/elevate');
Expand Down