Bug 641901 - Packages API inconsistency
Summary: Packages API inconsistency
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: Sayli Karmarkar
QA Contact: wes hayutin
URL:
Whiteboard:
Depends On:
Blocks: verified-to-close
TreeView+ depends on / blocked
 
Reported: 2010-10-11 13:20 UTC by Jay Dobies
Modified: 2015-03-23 01:10 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-08-16 14:20:13 UTC
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.