Bug 1221703

Summary: GPG key urls not updated on upgrade from 6.0 -> 6.1
Product: Red Hat Satellite Reporter: Justin Sherrill <jsherril>
Component: UpgradesAssignee: Justin Sherrill <jsherril>
Status: CLOSED CURRENTRELEASE QA Contact: Sachin Ghai <sghai>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.0.4CC: bbuckingham, bkearney, cwelton
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/10512
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 13:57:28 UTC Type: ---
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: 1222513    
Bug Blocks:    

Description Justin Sherrill 2015-05-14 15:26:42 UTC
After upgrading to 2.2, gpg key urls are not updated to go through an isolated capsule.

A rake task was added   'rake katello:upgrades:2.2:update_gpg_key_urls' to perform this, but it was never added to the installer.

Steps to reproduce:

1.  Install katello 2.1
2.  Create a repository attached to a gpg key
3.  Upgrade to 2.2
4.  Install an isolated capsule 
5.  Register a system to the isolated capsule and subscribe it to the repo's product

results:  Gpg key listed in redhat.repo goes to the satellite and not the capsule.

Comment 1 Justin Sherrill 2015-05-14 15:26:43 UTC
Created from redmine issue http://projects.theforeman.org/issues/10512

Comment 2 Justin Sherrill 2015-05-14 15:26:45 UTC
Upstream bug assigned to jsherril

Comment 3 Justin Sherrill 2015-05-14 15:27:50 UTC
Note, there is a workaround, simply run:

foreman-rake katello:upgrades:2.2:update_gpg_key_urls

Comment 5 Bryan Kearney 2015-05-15 17:55:31 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/10512 has been closed
-------------
Justin Sherrill
Applied in changeset commit:katello-installer|bc091d97eef4b1151c9bbc89e0b6f75414004d01.

Comment 8 Sachin Ghai 2015-05-25 11:38:48 UTC
Verified with snap5 compose2:

I successfully upgrade sat6.0 to sat6.1 and can see new task for upgrading the updating the gpg-key urls to support capsule isolation.

[root@sat6-qe-rhel66 yum.repos.d]# katello-installer --upgrade
Upgrading...
Upgrade Step: stop_services...
Upgrade Step: start_mongo...
Upgrade Step: migrate_pulp...
Upgrade Step: migrate_candlepin...
Upgrade Step: migrate_foreman...
Upgrade Step: Running installer...
Installing             Done                                               [100%] [..................................................................]
  The full log is at /var/log/katello-installer/katello-installer.log
Upgrade Step: Restarting services...
Upgrade Step: db:seed...
Upgrade Step: Running errata import task (this may take a while)...
Upgrade Step: Update gpg key urls to support capsule isolation (this may take a while)...
Upgrade Step: Update repositories to specify metadata_expire (this may take a while)...
Katello upgrade completed!
[

I'll check the gpg-key URL on client and will update another comment.

Comment 9 Sachin Ghai 2015-05-26 06:48:11 UTC
Verified with snap5 compose2:

Steps performed:

1. Installed sat6.0.8 from CDN
2. created custom repo with gpg-key
3. Added  6.1 capsule repo
4. upgraded sat6.0.8 to sta6.1 GA snap5 compose2
5. Installed 6.1 isolated capsule
6. register a client with 6.1 isolated capsule
7. Fetched the packages from repo created in step2 via isolated capsule.
8. I can see the gpgkey and repo-url points to capsule.

here is the snippet from redhat.repo. I've created fake repos with gpg-keys in satellite and later syced with external capsule.

Since I registered the host with external capsule so url points to external capsule here:

--


[Default_Organization_fake_fake_zoo]
metadata_expire = 1
sslclientcert = /etc/pki/entitlement/3842735161670405549.pem
baseurl = https://sat61-capsule-rhel66.usersys.redhat.com/pulp/repos/Default_Organization/dev/cv_rhel66/custom/fake/fake_zoo
sslverify = 1
name = fake_zoo
sslclientkey = /etc/pki/entitlement/3842735161670405549-key.pem
gpgkey = https://sat61-capsule-rhel66.usersys.redhat.com/katello/api/repositories/4/gpg_key_content
enabled = 1
sslcacert = /etc/rhsm/ca/katello-server-ca.pem
gpgcheck = 1

--

Comment 10 Sachin Ghai 2015-05-26 07:04:17 UTC
I can see the correct URL's for gpg-key and repos pointing to external capsule. But while installing packages I got following issue:

PG key retrieval failed: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

[root@sat6-client-rhel66 ~]# yum install cow
Loaded plugins: product-id, security, subscription-manager
Setting up Install Process
Default_Organization_fake_fake_zoo                                                                                             | 2.1 kB     00:00     
Default_Organization_rhel66_rhel6_x86_64                                                                                       | 2.5 kB     00:00     
Default_Organization_rhel66_sat61_capsule                                                                                      | 2.1 kB     00:00     
Default_Organization_rhel66_sat61_tools                                                                                        | 2.1 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package cow.noarch 0:2.2-3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                   Arch                         Version                        Repository                                                Size
======================================================================================================================================================
Installing:
 cow                       noarch                       2.2-3                          Default_Organization_fake_fake_zoo                       2.4 k

Transaction Summary
======================================================================================================================================================
Install       1 Package(s)

Total download size: 2.4 k
Installed size: 42  
Is this ok [y/N]: y
Downloading Packages:
cow-2.2-3.noarch.rpm                                                                                                           | 2.4 kB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID f78fb195: NOKEY
Retrieving key from https://sat61-capsule-rhel66.usersys.redhat.com/katello/api/repositories/4/gpg_key_content


GPG key retrieval failed: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
[root@sat6-client-rhel66 ~]#

Comment 11 Justin Sherrill 2015-05-27 14:20:41 UTC
This error is caused by https://bugzilla.redhat.com/show_bug.cgi?id=1222513

Comment 12 Justin Sherrill 2015-06-03 16:13:59 UTC
Moving to POST, as the cause has been moved.

Comment 15 Sachin Ghai 2015-06-15 06:31:38 UTC
Verified with sat6.1 GA snap8 (RC1)

GPG key URLs updated and pointing to isolated capsule not to satellite server. I can fetch/install the packages from capsule to client host.

[Default_Organization_fake_fake_zoo1]
metadata_expire = 1
sslclientcert = /etc/pki/entitlement/5528938802549671068.pem
baseurl = https://sat61-capsule-rhel66.usersys.redhat.com/pulp/repos/Default_Organization/dev/cv_rhel66_sat61/custom/fake/fake_zoo1
sslverify = 1
name = fake_zoo1
sslclientkey = /etc/pki/entitlement/5528938802549671068-key.pem
gpgkey = https://sat61-capsule-rhel66.usersys.redhat.com/katello/api/repositories/40/gpg_key_content
enabled = 1
sslcacert = /etc/rhsm/ca/katello-server-ca.pem
gpgcheck = 1





[root@sat6-client-rhel66 yum.repos.d]# yum install cow -y
Loaded plugins: product-id, security, subscription-manager
Setting up Install Process
Default_Organization_fake_fake_zoo1                                                                                            | 2.1 kB     00:00     
Default_Organization_rhel6_custom_rhel66                                                                                       | 2.5 kB     00:00     
Default_Organization_sat61_capsule_sat61_capsule_rhel66                                                                        | 2.1 kB     00:00     
Default_Organization_sat61_tools_sat61_tools_rhel66                                                                            | 2.1 kB     00:00     
Resolving Dependencies
--> Running transaction check
---> Package cow.noarch 0:2.2-3 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                   Arch                         Version                       Repository                                                 Size
======================================================================================================================================================
Installing:
 cow                       noarch                       2.2-3                         Default_Organization_fake_fake_zoo1                       2.4 k

Transaction Summary
======================================================================================================================================================
Install       1 Package(s)

Total download size: 2.4 k
Installed size: 42  
Downloading Packages:
cow-2.2-3.noarch.rpm                                                                                                           | 2.4 kB     00:00     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID f78fb195: NOKEY
Retrieving key from https://sat61-capsule-rhel66.usersys.redhat.com/katello/api/repositories/40/gpg_key_content
Importing GPG key 0xF78FB195:
 Userid: "Dummy Packages Generator <admin.com>"
 From  : https://sat61-capsule-rhel66.usersys.redhat.com/katello/api/repositories/40/gpg_key_content
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : cow-2.2-3.noarch                                                                                                                   1/1 
Default_Organization_rhel6_custom_rhel66/productid                                                                             | 1.6 kB     00:00     
  Verifying  : cow-2.2-3.noarch                                                                                                                   1/1 

Installed:
  cow.noarch 0:2.2-3                                                                                                                                  

Complete!
[root@sat6-client-rhel66 yum.repos.d]# rpm -qa | grep cow
cow-2.2-3.noarch
[root@sat6-client-rhel66 yum.repos.d]#

Comment 16 Bryan Kearney 2015-08-11 13:31:38 UTC
This bug is slated to be released with Satellite 6.1.

Comment 17 Bryan Kearney 2015-08-12 13:57:28 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.