diff --git a/elevate-cpanel b/elevate-cpanel index ec657592..1dfdbd1c 100755 --- a/elevate-cpanel +++ b/elevate-cpanel @@ -2026,13 +2026,12 @@ EOS sub _blocker_cpanel_needs_update ($self) { if ( !$self->getopt('skip-cpanel-version-check') ) { - my $tiers_obj = Cpanel::Update::Tiers->new( logger => Log::Log4perl->get_logger(__PACKAGE__) ); - if ( !grep { Cpanel::Version::Compare::compare( $Cpanel::Version::Tiny::VERSION_BUILD, '==', $_ ) } $tiers_obj->get_flattened_hash()->@{qw/edge current release stable lts/} ) { - my $hint = ''; - $hint = q[hint: You can skip this check using --skip-cpanel-version-check] if $Cpanel::Version::Tiny::VERSION_BUILD =~ 9999; + my $tiers_obj = Cpanel::Update::Tiers->new( logger => Log::Log4perl->get_logger(__PACKAGE__) ); + my $expected_version = $tiers_obj->get_flattened_hash()->{'11.110'}; + if ( !Cpanel::Version::Compare::compare( $Cpanel::Version::Tiny::VERSION_BUILD, '==', $expected_version ) ) { return $self->has_blocker( <<~"EOS" ); This installation of cPanel ($Cpanel::Version::Tiny::VERSION_BUILD) does not appear to be up to date. - Please upgrade cPanel to a more recent version. $hint + Please upgrade cPanel to $expected_version. EOS } } diff --git a/lib/Elevate/Blockers/WHM.pm b/lib/Elevate/Blockers/WHM.pm index bb50eb14..dc91051f 100644 --- a/lib/Elevate/Blockers/WHM.pm +++ b/lib/Elevate/Blockers/WHM.pm @@ -107,13 +107,12 @@ sub _blocker_cpanel_needs_license ($self) { sub _blocker_cpanel_needs_update ($self) { if ( !$self->getopt('skip-cpanel-version-check') ) { - my $tiers_obj = Cpanel::Update::Tiers->new( logger => Log::Log4perl->get_logger(__PACKAGE__) ); - if ( !grep { Cpanel::Version::Compare::compare( $Cpanel::Version::Tiny::VERSION_BUILD, '==', $_ ) } $tiers_obj->get_flattened_hash()->@{qw/edge current release stable lts/} ) { - my $hint = ''; - $hint = q[hint: You can skip this check using --skip-cpanel-version-check] if $Cpanel::Version::Tiny::VERSION_BUILD =~ 9999; + my $tiers_obj = Cpanel::Update::Tiers->new( logger => Log::Log4perl->get_logger(__PACKAGE__) ); + my $expected_version = $tiers_obj->get_flattened_hash()->{'11.110'}; + if ( !Cpanel::Version::Compare::compare( $Cpanel::Version::Tiny::VERSION_BUILD, '==', $expected_version ) ) { return $self->has_blocker( <<~"EOS" ); This installation of cPanel ($Cpanel::Version::Tiny::VERSION_BUILD) does not appear to be up to date. - Please upgrade cPanel to a more recent version. $hint + Please upgrade cPanel to $expected_version. EOS } } diff --git a/t/blocker-whm.t b/t/blocker-whm.t index ce370e3e..71990623 100644 --- a/t/blocker-whm.t +++ b/t/blocker-whm.t @@ -148,6 +148,8 @@ my $whm = $cpev->get_blocker('WHM'); note "cPanel & WHM latest version."; clear_messages_seen(); + my $latest_lts_version = "11.110.0.15"; + my $mock_tiers = Test::MockModule->new('Cpanel::Update::Tiers'); $mock_tiers->redefine( sync_tiers_file => 1, @@ -169,6 +171,13 @@ my $whm = $cpev->get_blocker('WHM'); "named" => [ "current", "edge" ], } ], + "11.110" => [ + { + "build" => $latest_lts_version, + "is_main" => 1, + "named" => [ "lts" ], + } + ], }, }, ); @@ -195,7 +204,7 @@ my $whm = $cpev->get_blocker('WHM'); msg => qr{ \QThis installation of cPanel (11.102.0.5) does not appear to be up to date.\E \s+ - \QPlease upgrade cPanel to a more recent version.\E + \QPlease upgrade cPanel to $latest_lts_version.\E }xms, }, q{obsolete version generates a blocker.} @@ -203,7 +212,7 @@ my $whm = $cpev->get_blocker('WHM'); clear_messages_seen(); - $Cpanel::Version::Tiny::VERSION_BUILD = '11.102.0.7'; + $Cpanel::Version::Tiny::VERSION_BUILD = $latest_lts_version; is( $whm->_blocker_cpanel_needs_update(), 0, "No blocker if cPanel is up to date" ); no_messages_seen(); }