Project

General

Profile

Actions

Bug #35533

closed

'candlepin-validate-db' pre-upgrade check fails with "Could not open SSL root certificate file /root/.postgresql/root.crt" error for external DB setup with SSL

Added by Amit Upadhye about 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Fixed in Releases:
Found in Releases:

Description

Description of problem:
satellite pre-upgrade check to validate candlepin db 'candlepin-validate-db' fails with "Could not open SSL root certificate file /root/.postgresql/root.crt" error for external DB setup with SSL

Version-Release number of selected component (if applicable):
Satellite 6.11.2 Snap 2.0 and Satellite 6.12.0 Snap 9.0

How reproducible:
Always

Steps to Reproduce:
1. # foreman-maintain upgrade check --target-version 6.12
OR
1. # foreman-maintain health check --label candlepin-validate-db
```
--------------------------------------------------------------------------------
Check to validate candlepin database: [FAIL]
  1. ERROR ############
    Error running command: /usr/share/candlepin/liquibase.sh --driver=org.postgresql.Driver --classpath=/var/lib/tomcat/webapps/candlepin/WEB-INF/lib/postgresql-42.3.3.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --changeLogFile=db/changelog/changelog-validate.xml --url="jdbc:postgresql://satellite.example.com:5432/candlepin1db?ssl=true" --username=$DBUSERNAME --password=$DBPASSWORD --logLevel=debug migrate -Dcommunity=False
    Status code: 255
    Command output: Liquibase update Failed: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: Could not open SSL root certificate file /root/.postgresql/root.crt.
    SEVERE 9/6/22, 9:09 AM:liquibase: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: Could not open SSL root certificate file /root/.postgresql/root.crt.
    liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: Could not open SSL root certificate file /root/.postgresql/root.crt.
    at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:61)
    at liquibase.integration.commandline.Main.doMigration(Main.java:788)
    at liquibase.integration.commandline.Main.main(Main.java:133)
    Caused by: liquibase.exception.DatabaseException: org.postgresql.util.PSQLException: Could not open SSL root certificate file /root/.postgresql/root.crt.
    at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:231)
    at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:141)
    at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:52)
    ... 2 more
    Caused by: org.postgresql.util.PSQLException: Could not open SSL root certificate file /root/.postgresql/root.crt.
    at org.postgresql.ssl.LibPQFactory.<init>(LibPQFactory.java:150)
    at org.postgresql.core.SocketFactoryFactory.getSslSocketFactory(SocketFactoryFactory.java:61)
    at org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:34)
    at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:571)
    at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:168)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:235)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:223)
    at org.postgresql.Driver.makeConnection(Driver.java:400)
    at org.postgresql.Driver.connect(Driver.java:259)
    at liquibase.database.DatabaseFactory.openConnection(DatabaseFactory.java:223)
    ... 4 more
    Caused by: java.io.FileNotFoundException: /root/.postgresql/root.crt (No such file or directory)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
    at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
    at org.postgresql.ssl.LibPQFactory.<init>(LibPQFactory.java:147)
    ... 14 more

For more information, use the --logLevel flag
Configuring PostgreSQL with JDBC URL: jdbc:postgresql://satellite.example.com:5432/candlepin1db?ssl=true
Validating Candlepin database
--driver=org.postgresql.Driver --classpath=/var/lib/tomcat/webapps/candlepin/WEB-INF/lib/postgresql-42.3.3.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --changeLogFile=db/changelog/changelog-validate.xml --url="jdbc:postgresql://satellite.example.com:5432/candlepin1db?ssl=true" --username=$DBUSERNAME --password=$DBPASSWORD --logLevel=debug
Traceback (most recent call last):
File "/usr/share/candlepin/cpdb", line 287, in <module>
dbsetup.validate()
File "/usr/share/candlepin/cpdb", line 75, in validate
self._run_liquibase("db/changelog/changelog-validate.xml")
File "/usr/share/candlepin/cpdb", line 114, in _run_liquibase
output = run_command("/usr/share/candlepin/liquibase.sh %s migrate Dcommunity=%s" % (liquibase_options, self.community))
File "/usr/share/candlepin/cpdb", line 43, in run_command
error_out(command, status, output)
File "/usr/share/candlepin/cpdb", line 51, in error_out
raise Exception("Error running command")
Exception: Error running command
-------------------------------------------------------------------------------

```

Actual results:

Expected results:

Additional info:
Seems similar to BZ 2090820

Actions

Also available in: Atom PDF