Problem:
Receiving a cpdb --upgrade error when attempting to run the forman upgrade.
/Stage[main]/Candlepin::Database::Postgresql/Exec[cpdb update]/returns: change from 'notrun' to ['0'] failed: 'cpdb --update --dbhost=localhost --dbport=5432 --database='candlepin' --user='candlepin' --password='[PASSWORD]' >> /var/log/candlepin/cpdb.log 2>&1 && touch /var/lib/candlepin/cpdb_update_done' returned 1 instead of one of [0]
Expected outcome:
There would be no error, and Foreman-katello would be able to upgrade to 3.15
Foreman and Proxy versions:
Unsure Since starting this process I’ve been unable to log into forman with my user account. Katello 3.14
Foreman and Proxy plugin versions:
Unsure Since starting this process I’ve been unable to log into forman with my user account. Katello 3.14
Distribution and version:
Unsure Since starting this process I’ve been unable to log into forman with my user account. Katello 3.14
Other relevant data:
Been trying to upgrade Foreman-Katello from 3.14 to 3.15 for a few days. Which lead me through the following articles:
Looks like the table for public.cp_consumer_type does not exsist.
> ########## ERROR ############
> Error running command: /usr/share/candlepin/liquibase.sh --driver=org.postgresql.Driver --classpath=/var/lib/tomcat/webapps/candlepin/WEB-INF/lib/postgresql-42.2.2.jar:/var/lib/tomcat/webapps/candlepin/WEB-INF/classes/ --changeLogFile=db/changelog/changelog-update.xml --url="jdbc:postgresql://localhost:5432/candlepin" --username=$DBUSERNAME --password=$DBPASSWORD --logLevel=severe migrate -Dcommunity=False
> Status code: 65280
> Command output: SEVERE 6/3/20 11:57 AM:liquibase: db/changelog/changelog-update.xml: db/changelog/20120416134048-insert-uebercert-consumer-type.xml::20120416134048::mstead: Change Set db/changelog/20120416134048-insert-uebercert-consumer-type.xml::20120416134048::mstead failed. Error: Error executing SQL INSERT INTO public.cp_consumer_type (id, label, manifest) VALUES ('1005', 'uebercert', 'N'): ERROR: relation "public.cp_consumer_type" does not exist
> Position: 13
> liquibase.exception.DatabaseException: Error executing SQL INSERT INTO public.cp_consumer_type (id, label, manifest) VALUES ('1005', 'uebercert', 'N'): ERROR: relation "public.cp_consumer_type" does not exist
It seems like my instance was running Postgres 9.6 but because of trying to upgrade this it has made me downgrade to 9.2
I no longer have 9.6 but the data should still be there. Not exactly sure on how to get that data into the 9.2 instance if that is the problem. (Would explain why I can’t log into foreman any more )
Just so I understand correctly: everything was working OK before you attempted to upgrade, and that has left you in a broken state? ie you were able to log in before attempting the upgrade? If there was a problem before upgrading then you should revert to your backup, fix any issues there, and then attempt to upgrade.
@Jonathon_Turel I almost reverted back to the snapshot I took… but i had noticed that the foreman installer made it far enough to upgrade postgres on the host to the 12.1.
Since I figured I have the snapshot to move back to I dropped the postgresql 12 data folder, and used pg_upgrade to migrate the data from the 9.6 data folder to a new postgres 12 folder. everything seems to be working. I was able to fully run the foreman --upgrade command, I can now log back into foreman see that it is upgraded. My login is working again and all my host data is back.
With the proxy configured in yum.conf, something about our proxy breaks the certificate auth back to Foreman, so the directly-accessed external Foreman repos become accessible but the local RHEL content views break. We normally depend on no_proxy to ignore the proxy for Foreman, but I don’t think yum.conf supports that.
Also, since our Foreman is subscribed to itself for RHEL content, we’d have to pre-cache packages anyway. Just possibly not as many.
It’s mostly quirks specific to our setup and probably some self-inflicted pain. But if it helps anyone who’s ended up in the same place as the OP and myself…