#194 Allow querying unpublished Lightblue images.
Closed by jkaluza. Opened by jkaluza.
jkaluza/freshmaker lb-unpublished  into  master

Download 194.patch

This PR mainly changed the published, deprecated and release_category kwargs from various method to Lightblue class properties. The reason to do this is that otherwise, we would need to pass them down the method calls in almost every method in Lightblue to get them to image.resolve_content_sets() method. Using the attributes, the resolve_content_sets method can use them from Lightblue class instance.

The way how Lightblue class works by default remains the same, but it is now possible to write code like this to get the list of unpublished images to rebuild:

content_sets = pulp.get_content_set_by_repo_ids(["foo-server-release-e2e-test-1-rpms__x86_64"])
lb = LightBlue(...)
lb.published = None
lb.release_category = None
pprint.pprint(lb.find_images_to_rebuild("release-e2e-test", content_sets))

See https://pagure.io/freshmaker/pull-request/195 for alternative way.

1 new commit added

  • Return only the latest images when querying LB for unpublished container images.

I'm afraid I think the original method interface is good. With the original method interface, I can find out published and unpublished images, for example,

lb = LightBlue(...)
lb.find_images_with_included_srpm(repos, srpm_name, published=True)
lb.find_images_with_included_srpm(repos, srpm_name, published=False)

In contrast, changes in this PR cause me to do it in another way

lb.find_images_with_included_srpm(repos, srpm_name)
lb.published = False
lb.find_images_with_included_srpm(repos, srpm_name)

Both of them work. But the problem is who should own the attribute "published". Obviously, it should be the image, not a LightBlue object. The original code looks more natrually, if we think about and understand the code from OO point of view.

On the other hand, published is shared by several LightBlue methods, which limits us to use LightBlue in a multithread environment, even if we can handle the race condition. It makes things complicated.

Changes to deprecated and release_category have similar problems as above.

Yeah, I share that, but passing those three kwargs in all methods look painful to me. I can create PR doing so and we can compare that.

See https://pagure.io/freshmaker/pull-request/195 for alternative way.

Pull-Request has been closed by jkaluza

Metadata