Skip to content

Commit

Permalink
Update strings to be language agnostic for Ubuntu
Browse files Browse the repository at this point in the history
Case RE-945:

Audited all the strings for RHEL specific language &
updated to be inclusive for Ubuntu. (However, strings
output by code that only runs on RHEL systems were not
updated.) Also, the --help output was not updated as that
is to be addressed in another case.

Changelog: Update strings to be language agnostic for Ubuntu
  • Loading branch information
Tim Mullin committed Dec 5, 2024
1 parent d2c0421 commit 61f388b
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 19 deletions.
38 changes: 30 additions & 8 deletions elevate-cpanel
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ BEGIN { # Suppress load of all of these at earliest point.

sub check ($self) {
my %links = $self->get_abs_symlinks();
WARN( "Symlinks with absolute paths have been found in /:\n\t" . join( ", ", sort keys(%links) ) . "\n" . "This can cause problems during the leapp run, so\n" . 'these will be corrected to be relative symlinks before elevation.' ) if %links;
WARN( "Symlinks with absolute paths have been found in /:\n\t" . join( ", ", sort keys(%links) ) . "\n" . "This can cause problems during the distro upgrade, so\n" . 'these will be corrected to be relative symlinks before elevation.' ) if %links;
return;
}

Expand Down Expand Up @@ -1715,7 +1715,7 @@ EOS

sub _blocker_is_experimental_os ($self) {
if ( -e '/var/cpanel/caches/Cpanel-OS.custom' ) {
return $self->has_blocker('Experimental OS detected. This script only supports CentOS 7 upgrades');
return $self->has_blocker('Experimental OS detected. This script does not support it for upgrades.');
}

return 0;
Expand Down Expand Up @@ -3014,7 +3014,7 @@ EOS
if ( _is_container_envtype() ) {
return $self->has_blocker( <<~'EOS');
cPanel thinks that this is a container-like environment.
This cannot be upgraded by the native leapp tool.
This cannot be upgraded by this script.
Consider contacting your hypervisor provider for alternative solutions.
EOS
}
Expand Down Expand Up @@ -6223,7 +6223,7 @@ EOS

if ( $setup !~ m{^\s*PermitRootLogin\b}m ) {
WARN( <<~"EOS" );
OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file, which will default in RHEL8 to "prohibit-password".
OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file; this may default to "prohibit-password" after upgrading the distro.
We will set the 'PermitRootLogin' value in $sshd_config to 'yes' before upgrading.
EOS
Expand Down Expand Up @@ -10383,9 +10383,9 @@ sub start ($self) {
WARN( <<~"EOS");
Automated upgrade of the distro has been disabled.
Please wait for the file '$touchfile' to be created.
At that stage, the ELevate process is paused, and you can upgrade from 7 to 8 on your own.
At that stage, the ELevate process is paused, and you can upgrade the distro on your own.
Once the system has been successfully upgraded from 7 to 8, you can then remove that file
Once the system has been successfully upgraded, you can then remove that file
to let the ELevate process continue and update cPanel for the new distribution.
EOS
Elevate::StageFile::update_stage_file( { upgrade_distro_manually => 1 } );
Expand Down Expand Up @@ -10869,7 +10869,29 @@ sub run_stage_3 ($self) {
$self->ssystem_and_die( '/usr/bin/mount', '-o', 'remount,exec', '/tmp' );

INFO('Running do-release-upgrade');
$self->ssystem_and_die( '/usr/bin/do-release-upgrade', '-f', 'DistUpgradeViewNonInteractive' );
my $ret = $self->ssystem_capture_output( '/usr/bin/do-release-upgrade', '-f', 'DistUpgradeViewNonInteractive' );

if ( $ret->{status} != 0 ) {
my $stderr = join "\n", @{ $ret->{stderr} };

my $error_message = <<~"EOS";
Running do-release-upgrade has failed on your server with the
following error output:
$stderr
You may need to investigate the logs in /var/log/dist-upgrade
to find the cause.
Once you have resolved the issue(s), run the following command
to continue the update:
/scripts/elevate-cpanel --continue
EOS

die $error_message;
}
}

WARN(<<~'EOS');
Expand Down Expand Up @@ -10934,7 +10956,7 @@ sub run_stage_4 ($self) {
}

my $msg = <<~"END";
Server is currently running $current_distro $major after leapp upgrade.
Server is currently running $current_distro $major after distro upgrade.
Upgrade to $pretty_distro_name did not succeed.
END
Expand Down
2 changes: 1 addition & 1 deletion lib/Elevate/Components/AbsoluteSymlinks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ sub _absolute_symlinks ($self) {

sub check ($self) {
my %links = $self->get_abs_symlinks();
WARN( "Symlinks with absolute paths have been found in /:\n\t" . join( ", ", sort keys(%links) ) . "\n" . "This can cause problems during the leapp run, so\n" . 'these will be corrected to be relative symlinks before elevation.' ) if %links;
WARN( "Symlinks with absolute paths have been found in /:\n\t" . join( ", ", sort keys(%links) ) . "\n" . "This can cause problems during the distro upgrade, so\n" . 'these will be corrected to be relative symlinks before elevation.' ) if %links;
return;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Elevate/Components/Distros.pm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ sub _blocker_is_old_centos7 ($self) {

sub _blocker_is_experimental_os ($self) {
if ( -e '/var/cpanel/caches/Cpanel-OS.custom' ) {
return $self->has_blocker('Experimental OS detected. This script only supports CentOS 7 upgrades');
return $self->has_blocker('Experimental OS detected. This script does not support it for upgrades.');
}

return 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/Elevate/Components/IsContainer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ sub check ($self) { # $self is a cpev object here
if ( _is_container_envtype() ) {
return $self->has_blocker( <<~'EOS');
cPanel thinks that this is a container-like environment.
This cannot be upgraded by the native leapp tool.
This cannot be upgraded by this script.
Consider contacting your hypervisor provider for alternative solutions.
EOS
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Elevate/Components/SSH.pm
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ sub _check_ssh_config ($self) {

if ( $setup !~ m{^\s*PermitRootLogin\b}m ) {
WARN( <<~"EOS" );
OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file, which will default in RHEL8 to "prohibit-password".
OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file; this may default to "prohibit-password" after upgrading the distro.
We will set the 'PermitRootLogin' value in $sshd_config to 'yes' before upgrading.
EOS
Expand Down
30 changes: 26 additions & 4 deletions script/elevate-cpanel.PL
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ sub start ($self) {
WARN( <<~"EOS");
Automated upgrade of the distro has been disabled.
Please wait for the file '$touchfile' to be created.
At that stage, the ELevate process is paused, and you can upgrade from 7 to 8 on your own.
At that stage, the ELevate process is paused, and you can upgrade the distro on your own.
Once the system has been successfully upgraded from 7 to 8, you can then remove that file
Once the system has been successfully upgraded, you can then remove that file
to let the ELevate process continue and update cPanel for the new distribution.
EOS
Elevate::StageFile::update_stage_file( { upgrade_distro_manually => 1 } );
Expand Down Expand Up @@ -1038,7 +1038,29 @@ sub run_stage_3 ($self) {
$self->ssystem_and_die( '/usr/bin/mount', '-o', 'remount,exec', '/tmp' );

INFO('Running do-release-upgrade');
$self->ssystem_and_die( '/usr/bin/do-release-upgrade', '-f', 'DistUpgradeViewNonInteractive' );
my $ret = $self->ssystem_capture_output( '/usr/bin/do-release-upgrade', '-f', 'DistUpgradeViewNonInteractive' );

if ( $ret->{status} != 0 ) {
my $stderr = join "\n", @{ $ret->{stderr} };

my $error_message = <<~"EOS";
Running do-release-upgrade has failed on your server with the
following error output:
$stderr
You may need to investigate the logs in /var/log/dist-upgrade
to find the cause.
Once you have resolved the issue(s), run the following command
to continue the update:
/scripts/elevate-cpanel --continue
EOS

die $error_message;
}
}

WARN(<<~'EOS');
Expand Down Expand Up @@ -1103,7 +1125,7 @@ sub run_stage_4 ($self) {
}

my $msg = <<~"END";
Server is currently running $current_distro $major after leapp upgrade.
Server is currently running $current_distro $major after distro upgrade.
Upgrade to $pretty_distro_name did not succeed.
END
Expand Down
2 changes: 1 addition & 1 deletion t/components-Distros.t
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ my $distros = $cpev->get_blocker('Distros');
$distros->check(),
{
id => q[Elevate::Components::Distros::_blocker_is_experimental_os],
msg => 'Experimental OS detected. This script only supports CentOS 7 upgrades',
msg => 'Experimental OS detected. This script does not support it for upgrades.',
},
'Custom OS is not supported.'
);
Expand Down
2 changes: 1 addition & 1 deletion t/components-IsContainer.t
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ my $mock = Test::MockModule->new('Elevate::Components::IsContainer');
my $cpev = cpev->new();
my $msg = <<~'EOS';
cPanel thinks that this is a container-like environment.
This cannot be upgraded by the native leapp tool.
This cannot be upgraded by this script.
Consider contacting your hypervisor provider for alternative solutions.
EOS

Expand Down
2 changes: 1 addition & 1 deletion t/components-SSH.t
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ my $ssh = bless {}, 'Elevate::Components::SSH';
my $mock_sshd_cfg = Test::MockFile->file(q[/etc/ssh/sshd_config]);

my $sshd_error_message = <<~'EOS';
OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file, which will default in RHEL8 to "prohibit-password".
OpenSSH configuration file does not explicitly state the option PermitRootLogin in sshd_config file; this may default to "prohibit-password" after upgrading the distro.
We will set the 'PermitRootLogin' value in /etc/ssh/sshd_config to 'yes' before upgrading.
EOS
Expand Down

0 comments on commit 61f388b

Please sign in to comment.