Bug 767311

Summary: redhat.repo being created with empty repo name headers, breaks yum.
Product: Red Hat Satellite Reporter: Corey Welton <cwelton>
Component: APIAssignee: Tomas Strachota <tstrachota>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.0.0CC: bkearney, hbrock, kbidarka
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: katello-0.1.220-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
(client): subscription-manager-0.98.3-1.el6.x86_64 (host): katello-0.1.135-2.el6.x86_64 ping result: {"result":"ok","status":{"pulp":{"result":"ok","duration_ms":"90"},"candlepin_auth":{"result":"ok","duration_ms":"17"},"pulp_auth":{"result":"ok","duration_ms":"52"},"candlepin":{"result":"ok","duration_ms":"18"}}}
Last Closed: 2012-08-22 18:13:41 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:    
Bug Blocks: 747354    

Description Corey Welton 2011-12-13 18:54:26 UTC
Description of problem:
After registering a system to katello and subsequently subscribing to a variety of (non-RH?) repos, a record is created in redhat.repo with an empty repo/product name header. Afterwards, yum cannot update.

Version-Release number of selected component (if applicable):


How reproducible:
readily, at least following these exact steps.

Steps to Reproduce:
1. On CLIENT box, rename or delete any existing /etc/yum.repos.d/redhat.repo
2. On KATELLO box:
  a) if it does not exist already, create a "dev" environment in ACME_Corporation.
  a) add RH product content to ACME_Corporation
  b) add two repos like so, to ACME_Corporation:
    Provider: Google
      Product: talkplugin
        Repo (name): talk plugin x86_64
        Repo (url): http://dl.google.com/linux/talkplugin/rpm/stable/x86_64
      Product: music
        Repo (name): music - x86_64
        Repo (url): http://dl.google.com/linux/musicmanager/rpm/stable/x86_64
3. Sync all repos
4. On CLIENT box, register to katello:
  subscription-manager register --force --username=admin --password=admin --org=ACME_Corporation --env=dev
5. List all available subscriptions in katello:
   subscription-manager list --available
6. Attempt to subscribe to all three available pools (substituting proper poolids)
  subscription-manager subscribe --pool  8a8b67673433345d0134342b77ed0028  --pool 8a8b67673433345d01343787515f0058 --pool 8a8b67673433345d013437887162005b
7. yum update
  
Actual results:
Loaded plugins: katello, product-id, rhnplugin, subscription-manager
Updating certificate-based repositories.
Config Error: File contains no section headers.
file: file://///etc/yum.repos.d/redhat.repo, line: 9
'[]\n'

Observing the newly created /etc/yum.repos.d/redhat.repo indicates:

[]
baseurl = 
...etc...


Expected results:
* The header should get populated appropriately
* Yum should work.

Additional info:

* I am fairly certain that this worked in recent builds of katello, because I was doing gpgkey testing and got as far as being able to pull down package names. Please see environment field above for relevant package versioning.

Comment 1 Kedar Bidarkar 2011-12-14 13:41:35 UTC
I get the repo name headers, but the $env values do not get parsed for repos other than f15.

It's the same even if I create a completely new env path, templates, changesets and promote all the three products at once. Only f15 repo's $env value get's parsed.

[music_manager]
name = music_manager
baseurl = https://xxx.redhat.com/pulp/repos/ACME_Corporation/$env/custom/music/music_manager
enabled = 1
gpgcheck = 1
sslverify = 1
sslcacert = /etc/rhsm/ca/candlepin-local.pem
sslclientkey = /etc/pki/entitlement/2808427121217571823-key.pem
sslclientcert = /etc/pki/entitlement/2808427121217571823.pem

[gtalk_plugin]
name = gtalk_plugin
baseurl = https://xxx.redhat.com/pulp/repos/ACME_Corporation/$env/custom/gtalk/gtalk_plugin
enabled = 1
gpgcheck = 1
sslverify = 1
sslcacert = /etc/rhsm/ca/candlepin-local.pem
sslclientkey = /etc/pki/entitlement/7877338748277184922-key.pem
sslclientcert = /etc/pki/entitlement/7877338748277184922.pem

[f15]
name = f15
baseurl = https://xxx.redhat.com/pulp/repos/ACME_Corporation/$env/custom/fedora15/f15
enabled = 1
gpgcheck = 1
sslverify = 1
sslcacert = /etc/rhsm/ca/candlepin-local.pem
sslclientkey = /etc/pki/entitlement/3702291654344418776-key.pem
sslclientcert = /etc/pki/entitlement/3702291654344418776.pem



[root@dhcp201-187 yum.repos.d]# yumdownloader google-talkplugin
Loaded plugins: product-id
https://scalpel.lab.eng.pnq.redhat.com/pulp/repos/ACME_Corporation/%24env/custom/gtalk/gtalk_plugin/google-talkplugin-2.5.6.0-1.x86_64.rpm: [Errno 14] HTTP Error 404 - Not Found : https://scalpel.lab.eng.pnq.redhat.com/pulp/repos/ACME_Corporation/$env/custom/gtalk/gtalk_plugin/google-talkplugin-2.5.6.0-1.x86_64.rpm
Trying other mirror.
Could not download/verify pkg google-talkplugin-2.5.6.0-1.x86_64: failure: google-talkplugin-2.5.6.0-1.x86_64.rpm from gtalk_plugin: [Errno 256] No more mirrors to try.



[root@scalpel Packages]# rpm -qav | grep -i katello 
katello-trusted-ssl-cert-1.0-1.noarch
katello-cli-common-0.1.23-3.el6.noarch
katello-certs-tools-1.0.1-2.el6.noarch
katello-glue-foreman-0.1.135-2.el6.x86_64
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-0.1.23-3.el6.noarch
katello-all-0.1.135-2.el6.x86_64
katello-configure-0.1.31-2.el6.noarch
katello-common-0.1.135-2.el6.noarch
katello-glue-candlepin-0.1.135-2.el6.x86_64
katello-0.1.135-2.el6.x86_64
katello-httpd-ssl-key-pair-1.0-1.noarch
katello-glue-pulp-0.1.135-2.el6.x86_64

Comment 2 Bryan Kearney 2011-12-14 13:48:54 UTC
Corey.. can you plese attach the certificate file?

Comment 3 Bryan Kearney 2011-12-14 13:50:10 UTC
Kedar:

Unles you have the latest subscription-mamnager you will not see the $env be replaced. To Work around this create a file 

/etc/yum/vars/env

with on line which is the name of your environment.

Comment 4 Corey Welton 2011-12-16 14:10:21 UTC
Kedar,

Your test is invalid.  You've not named your repos/products exactly as I have above.  I suspect it has something to do with spaces in the names. I am retesting with a fresh katello.

Bryan: the RH cert?  It was one from November, I forget which, now - but it's not choking on the RH cert, it's choking on a third party repo.

Comment 7 Tomas Strachota 2012-02-07 12:39:28 UTC
Fixed in katello-0.1.220-1

Tested with:
subscription-manager-0.99.6-1
python-rhsm-0.99.3-1
candlepin-0.5.8-1
katello-0.1.220-1

Got following headers in redhat.repo:
ACME_Corporation_talkplugin_talk_plugin_x86_64
ACME_Corporation_music_music_x86_64

Comment 8 Corey Welton 2012-02-15 20:14:20 UTC
QA Verified.