Bug 641901

Summary: Packages API inconsistency
Product: [Retired] Pulp Reporter: Jay Dobies <jason.dobies>
Component: z_otherAssignee: Sayli Karmarkar <skarmark>
Status: CLOSED CURRENTRELEASE QA Contact: wes hayutin <whayutin>
Severity: medium Docs Contact:
Priority: low    
Version: unspecifiedCC: cperry, pthomas, tsanders
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-16 14:20:13 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: 647488    

Description Jay Dobies 2010-10-11 13:20:53 UTC
We need to make sure the API gets cleaned up to return consistent values, and that the documentation gets written to indicate what the desired return type is.

    def packages(self, id, name=None):
        """
        Return list of Package objects in this Repo
        """
        repo = self._get_existing_repo(id)
        packages = repo['packages']
        # XXX this is WRONG!!!!, we are returning a dict if name is None
        # otherwise we are returning a list!
        if name is None:
            return packages
        return [p for p in packages.values() if p['name'].find(name) >= 0]

Comment 1 Sayli Karmarkar 2010-11-01 07:15:51 UTC
Fixed api to return list in both cases and added api docs.

Comment 2 Jay Dobies 2010-11-03 19:35:23 UTC
Fixed in build 0.78.

Comment 3 Jay Dobies 2010-12-06 18:41:46 UTC
Preethi asked me to comment on how to verify it.

From what I can see, the only place this call is being used is in test cases. So basically, if the unit tests pass, then this works. I'm going to assume a test case was added to test both the name=None and name=NotNone cases, so as long as hudson isn't blowing up, this should be good.

Comment 4 Preethi Thomas 2010-12-06 18:43:21 UTC
moving to verified as per the above comment!

Comment 5 Preethi Thomas 2011-08-16 14:20:13 UTC
Closing with Community Release 15

pulp-0.0.223-4.