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

cPanel won't recognize PG as installed for the purposes of WHM & cPanel UIs when upgraded #1

Open
troglodyne opened this issue Jul 21, 2020 · 9 comments
Assignees
Labels
bug Something isn't working waiting-on-cpanel-bugfix This bug can't be fixed without cPanel changing code

Comments

@troglodyne
Copy link
Collaborator

The silly regexp in our haspostgres check just doesn't pick up on the RPM names.

Will have to figure out some way to dope out the globalcache.

@troglodyne troglodyne added the bug Something isn't working label Jul 21, 2020
@troglodyne troglodyne self-assigned this Jul 21, 2020
@troglodyne
Copy link
Collaborator Author

Will try to knock this out soon

@troglodyne
Copy link
Collaborator Author

# perl -mCpanel::DbUtils -e 'print Cpanel::DbUtils::find_psql() . "\n" . Cpanel::DbUtils::find_postmaster() .  "\n";'      
/usr/bin/psql

So, looks like /usr/local/cpanel/Cpanel/PostgresAdmin/Check.pm fails the check due to not being able to find the postmaster.
Will have to investigate Cpanel/DbUtils.pm now

@troglodyne
Copy link
Collaborator Author

# which postmaster
/usr/bin/which: no postmaster in (/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/cpanel/composer/bin:/root/bin)

@troglodyne
Copy link
Collaborator Author

Looks like I need to additionally link postmaster with update-alternatives

@troglodyne
Copy link
Collaborator Author

So, if I do this, I get an interesting result from build_global_cache:

root@hydra cpanel  # bin/build_global_cache
Building global cache for cpanel...Use of uninitialized value $pmajor in numeric lt (<) at /usr/local/cpanel/Cpanel/PostgresAdmin/Check.pm line 65.
Use of uninitialized value $pmajor in concatenation (.) or string at /usr/local/cpanel/Cpanel/PostgresAdmin/Check.pm line 66.
Use of uninitialized value $pminor in concatenation (.) or string at /usr/local/cpanel/Cpanel/PostgresAdmin/Check.pm line 66.
Done

Probably the same thing where on PG 10 I had to write my own version getter due to the cP regexp being a disaster

troglodyne added a commit that referenced this issue Aug 8, 2020
@troglodyne
Copy link
Collaborator Author

troglodyne commented Aug 8, 2020

yep, this check is still bonehead:

teo@hydra better-postgres4cP (master) $ postmaster --version
postgres (PostgreSQL) 10.13

In the code:

 60     my $psqlversion = Cpanel::GlobalCache::cachedcommand( 'cpanel', $postmaster, '--version' );
 61     if ($psqlversion) {
 62         $psqlversion =~ m/(\d+)\.(\d+)\.\d+/;
 63         my $pmajor = $1;
 64         my $pminor = $2;
 65         if ( $pmajor < 7 || ( $pmajor == 7 && $pminor < 3 ) ) {
 66             return { 'status' => 0, 'message' => "PostgreSQL version is not sufficient. Version $pmajor.$pminor is not supported." };
 67         }
 68         $short_version = $pmajor . '.' . $pminor;
 69     }
 70     else {
 71         return { 'status' => 0, 'message' => 'Failed to determine PostgreSQL version from server.' };
 72     }

Why does it look for the third dot when it totally isn't used? This seems like bullshit to me.
Gonna file this internally, as this level of specificity is neither necessary or helpful.

@troglodyne
Copy link
Collaborator Author

So, monkeypatched that to fix that check, now haspostgres looks good

Problem is the service driver is disaster now:

Waiting for “postgresql” to start ………failed.

Cpanel::Exception::Services::StartError Service Status
undefined status from Cpanel::ServiceManager::Services::Postgresql

Service Error
(XID b2rj2z) The “postgresql” service failed to start.

Startup Log
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

postgresql has failed. Contact your system administrator if the service does not automagically recover.

Service Changes Complete

@troglodyne
Copy link
Collaborator Author

Filed CPANEL-33721 internally about the PG version check, gonna split the pg service driver stuff out into its' own issue

@troglodyne troglodyne added the waiting-on-cpanel-bugfix This bug can't be fixed without cPanel changing code label Aug 8, 2020
@troglodyne
Copy link
Collaborator Author

Fix coming in cPanel v92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting-on-cpanel-bugfix This bug can't be fixed without cPanel changing code
Projects
None yet
Development

No branches or pull requests

1 participant