Bug 1406782

Summary: Cannot upgrade 5.6 with embedded database to 5.8 with managed db
Product: Red Hat Satellite 5 Reporter: Ales Dujicek <adujicek>
Component: UpgradesAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 580CC: lhellebr, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rhn-upgrade-5.8.0.13 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-21 12:15:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1358815    

Description Ales Dujicek 2016-12-21 13:05:27 UTC
Description of problem:

upgrade Sat 5.6 with embedded database to 5.8 with managed database failed

# ./install.pl --upgrade --disconnected --external-postgresql
* Starting Red Hat Satellite installer.
* Performing pre-install checks.
* Pre-install checks complete.  Beginning installation.
* RHSM Registration.
** Registration: Disconnected mode. Not registering with RHSM.
* RHSM Subscriptions.
** Subscriptions: Disconnected mode. Not attaching subscriptions.
** Subscriptions: Disconnected mode. Not enabling repositories.
* Upgrade flag passed.  Stopping necessary services.
* Purging conflicting packages.
* Checking for uninstalled prerequisites.
** Checking if yum is available ...
There are some packages from Red Hat Enterprise Linux that are not part
of the @base group that Satellite will require to be installed on this
system. The installer will try resolve the dependencies automatically.
However, you may want to install these prerequisites manually.
Do you want the installer to resolve dependencies [y/N]? y
* Installing Satellite packages.
* Now running spacewalk-setup.
* Setting up SELinux..
** Database: Setting up database connection for PostgreSQL backend.
Hostname (leave empty for local)? remote-managed-database
Port [5432]? 
Database [rhnschema]? satschema
Username [rhnuser]? satuser
Password [******]? 
** Database: Populating database.
** Database: Skipping database population.
* Configuring tomcat.
* Setting up users and groups.
** GPG: Initializing GPG and importing key.
* Performing initial configuration.
* Activating Red Hat Satellite.
** Manifest not activated.
** Upgrade process requires the manifest to be activated after the schema is upgraded.
* Configuring apache SSL virtual host.
Should setup configure apache's default ssl server for you (saves original ssl.conf) [Y]? 
* Configuring jabberd.
* Creating SSL certificates.
** Skipping SSL certificate generation.
* Deploying configuration files.
* Update configuration in database.
DBD::Pg::st execute failed: ERROR:  relation "rhntemplatestring" does not exist
LINE 2:   FROM rhnTemplateString TS
               ^ at /usr/bin/spacewalk-setup line 939, <STDIN> line 6.
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Pg::db handle dbname=satschema;host=remote-managed-database;port=5432 at /usr/bin/spacewalk-setup line 939, <STDIN> line 6.


And database is empty..
# spacewalk-sql -i
\dpsql (8.4.20, server 9.5.4)
WARNING: psql version 8.4, server version 9.5.
         Some psql features might not work.
Type "help" for help.

satschema=# \d
No relations found.



Version-Release number of selected component (if applicable):
rhn-upgrade-5.8.0.6-1.el6sat.noarch
spacewalk-setup-2.5.1-13.el6sat.noarch

Comment 1 Tomáš Kašpárek 2016-12-21 14:13:51 UTC
This is not supported scenario for upgrades, however the documentation may look a little misleading so I'd consider this a documentation bug (there are really no steps how to move between embedded and managed/external db during upgrades).

Comment 4 Lukáš Hellebrandt 2017-05-24 12:02:55 UTC
Verified with rhn-upgrade-5.8.0.23-1.

The rhn-upgrade's file /etc/sysconfig/rhn/satellite-upgrade/doc/satellite-upgrade-postgresql.txt now contains

"""
If you are migrating your database from Oracle to managed or external PostgreSQL option, or if you already have external or managed PostgreSQL database add the following switch:
"""

instead of

"""
If you are migrating your database to managed or external PostgreSQL option, add the following switch:
"""