Bug 1411355

Summary: install.pl cannot activate satellite during managed-and-os-upgrade
Product: Red Hat Satellite 5 Reporter: Ales Dujicek <adujicek>
Component: UpgradesAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Ales Dujicek <adujicek>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 580CC: galtukho, jdobes, rdrazny, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: spacewalk-setup-2.5.1-14-sat rhn-upgrade-5.8.0.23-1-sat Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-21 12:14:05 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: 1393921, 1400201    

Description Ales Dujicek 2017-01-09 14:39:44 UTC
Description of problem:

I tried to upgrade Sat 5.6 on RHEL 5 with managed db to Sat 5.8 on RHEL 6 with managed db

I followed instructions to install new 5.8 Sat
./install.pl --external-postgresql
...
I pointed it to upgraded managed db:
** Database: Setting up database connection for PostgreSQL backend.
Hostname (leave empty for local)? managed.db.example.com
Port [5432]? 
Database? rhnmandb
Username? rhnuser
Password? 
...
I did not want to clear schema:
The Database has schema.  Would you like to clear the database [Y]? N
...
* Activating Red Hat Satellite.
Where is your satellite manifest file? /root/580-manifest.zip
** Loading Red Hat Satellite Manifest.
** Verifying manifest locally.
** Activating Red Hat Satellite.
There was a problem activating the satellite: Local activation failure.


problem is that I had 5.6 schema in the database, certificate is 5.8 and spacewalk-setup did not provide --ignore-version-mismatch

/var/log/rhn/rhn_installation.log:

ERROR: RHN Entitlement Certificate cannot be imported - the versions of current and new certificate do not match, [5.6] vs. [5.8]
If you are trying to upgrade the Satellite server, please see the upgrade documentation located here /etc/sysconfig/rhn/satellite-upgrade/README  (as part of the rhn-upgrade package).  WARNING: If you want to skip this check, please use --ignore-version-mismatch, but doing so may cause issues (including malfunction of the Satellite software).  Only skip the test if instructed to do so by a support technician.


then I tried to activate it manually but I it did not work
# rhn-satellite-activate --manifest ~/580-manifest.zip --ignore-version-mismatch
Populating channel families...
Channel families in cert: 1141
...
...
ERROR: Channel family 'rhel-devsuite-staging' was not found in mapping
ERROR: Channel family 'solaris-rhcmsys-beta' was not found in mapping
Updating certificates...

ERROR: unhandled exception occurred:
Traceback (most recent call last):
  File "/usr/bin/rhn-satellite-activate", line 38, in <module>
    sys.exit(abs(mod.main() or 0))
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/rhn_satellite_activate.py", line 463, in main
    cdn_activate.activate()
  File "/usr/lib/python2.6/site-packages/spacewalk/cdn_tools/activation.py", line 166, in activate
    self._update_certificates()
  File "/usr/lib/python2.6/site-packages/spacewalk/cdn_tools/activation.py", line 74, in _update_certificates
    constants.CA_CERT_NAME, ca_cert, None)
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/satCerts.py", line 687, in store_rhnCryptoKey
    description, org_id)
  File "/usr/lib/python2.6/site-packages/spacewalk/satellite_tools/satCerts.py", line 636, in _insertPrep_rhnCryptoKey
    description=description, org_id=org_id)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 151, in execute
    return self._execute_wrapper(self._execute, *p, **kw)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 296, in _execute_wrapper
    retval = function(*p, **kw)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 205, in _execute
    return self._execute_(args, kwargs)
  File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 318, in _execute_
    self._real_cursor.execute(self.sql, params)
psycopg2.IntegrityError: null value in column "org_id" violates not-null constraint
DETAIL:  Failing row contains (7, null, CDN-CA-CERT, 2, ).

first, I had to upgrade schema and then it was possible to activate Satellite



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

Comment 16 Radovan Drazny 2017-06-07 09:37:19 UTC
Re-verified on Satellite-5.8-RHEL-6-20170606.n.0, rhn-upgrade-5.8.0.23-1.el5sat.