Bug 790883

Summary: applicable_errata_in_repos returning empty results
Product: [Retired] Pulp Reporter: Brad Buckingham <bbuckingham>
Component: user-experienceAssignee: Sayli Karmarkar <skarmark>
Status: CLOSED NOTABUG QA Contact: Preethi Thomas <pthomas>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: cperry, gkhachik, skarmark
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-16 20:52:16 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:

Description Brad Buckingham 2012-02-15 16:27:18 UTC
Description of problem:

The consumer api to retrieve errata that are applicable to a consumer is returning empty results, when results are expected.

Version-Release number of selected component (if applicable):
pulp-0.0.264-1.fc15.noarch

How reproducible:
always

Steps to Reproduce:

(Note: this was viewed from katello, but general flow is below.)

1. created, synced and promoted repo - Note : repo chosen is rhel 6 update repo containing errata
2. registered system (consumer)
3. subscribed system to product associated with rhel 6 repo
4. verified that system is bound to the repo... e.g. 

  pulp-admin --username admin --password admin consumer list
+------------------------------------------+
            Consumer Information
+------------------------------------------+

Id                 	c79b900e-dd76-4fc2-aae1-469f79173c95
Description        	None                     
Capabilities       	{}                       
Subscribed Repos   	[u'ACME_Corporation-zoo-zoo', u'ACME_Corporation-rhel6_updates-rhel6_updates']
Agent:
   Responding      	No                       
   Last Heartbeat  	None                     
Additional info    	                         

5. retrieve list of applicable... from katello, this is done from the dashboard and invokes an api similar to the following:

curl -k -u admin:admin https://localhost/pulp/api/consumers/applicable_errata_in_repos/?repoids=ACME_Corporation-dev-rhel6_updates-rhel6_updates

Actual results:
the results from the applicable_errata_in_repos is empty (i.e. {}); however, there should be several errata associated with the system... we can see using the following api:

GET /pulp/api/consumers/c79b900e-dd76-4fc2-aae1-469f79173c95/errata/

Expected results:
expect to see errata applicable to consumers returned by the api

Additional info:

Comment 2 Sayli Karmarkar 2012-02-16 19:24:33 UTC
Brad,

Looks like query is not right. The subscribed repo is 'ACME_Corporation-rhel6_updates-rhel6_updates', but curl is asking for repoid ACME_Corporation-dev-rhel6_updates-rhel6_updates (Notice 'dev'). It makes sense that it is returning empty dictionary. Can you verify this with correct repoid before I close it?

Comment 3 Brad Buckingham 2012-02-16 20:46:12 UTC
Sayli,

Good catch!  It looks like Katello is not binding to the correct repo based on the environment the system/consumer is registered to.  

The following is the basic flow (using katello terms):

1. consumer registers to katello's 'dev' environment (subscription-manager)
2. consumer subscribes to a product/pool (subscription-manager)
3. admin executes yum repolist on consumer
4. katello-agent on the consumer sends an update to katello to inform it of the new repo that has been added.  e.g.

[INFO][PathMonitor1] report_enabled() @ katelloplugin.py:379 - reporting: {'enabled_repos': {'repos': [{'repositoryid': 'ACME_Corporation_rhel_6_updates_rhel_6_updates_repo_'}]}}

5. katello performs a bind with pulp on that repo

request:
"POST /pulp/api/consumers/f25ce574-00a4-4854-8e29-06b40cb04be7/bind/

resulting bind:

pulp-admin --username admin --password admin consumer list
+------------------------------------------+
            Consumer Information
+------------------------------------------+

Id                 	f25ce574-00a4-4854-8e29-06b40cb04be7
Description        	None                     
Capabilities       	{}                       
Subscribed Repos   	[u'ACME_Corporation-rhel_6_updates-rhel_6_updates_repo_']
Agent:
   Responding      	No                       
   Last Heartbeat  	None                     
Additional info    	                         

The issue here is that the consumer should actually be associated with the following repo:
ACME_Corporation-dev-rhel_6_updates-rhel_6_updates_repo_  (NOTE: the 'dev' in the repo id)

As a result, when katello requests the 'applicable_errata_in_repos', the results are empty.  In that request, we do not request the repo currently associated with the consumer.  The reason being, that repo is associated with the Katello 'Library' and there should be no systems/consumers registered to it.

Comment 4 Sayli Karmarkar 2012-02-16 20:52:16 UTC
Thanks, Brad. Closing it as not a bug. Please re-open if you see an issue with correct repo id subscribed. API seems to be returning correct result when tried separately on pulp.