RSPImageCollection¶
- class controller.models.domain.rspimage.RSPImageCollection(images, cycle=None)¶
Bases:
object
Provides operations on a collection of
RSPImage
objects.- Parameters:
Methods Summary
add
(image)Add an image to the collection.
all_images
(*[, hide_aliased, ...])All images in sorted order.
image_for_digest
(digest)Find an image by digest.
image_for_tag_name
(tag)Find an image by tag name.
latest
(image_type)Get the latest image of a given type.
mark_image_seen_on_node
(digest, node[, ...])Mark an image as seen on a node.
subset
(*[, releases, weeklies, dailies, include])Return a subset of the image collection.
subtract
(other)Find the list of images in this collection missing from another.
Methods Documentation
- add(image)¶
Add an image to the collection.
If this has the same digest as an image already in the collection, the newly added image will replace the old one for
image_for_digest
purposes.
- all_images(*, hide_aliased=False, hide_resolved_aliases=False)¶
All images in sorted order.
- Parameters:
hide_aliased (
bool
, default:False
) – IfTrue
, hide images that are the primary target of an alias tag in the same collection. This is used for menu generation to suppress a duplicate entry for an image that already appeared earlier in the menu under an alias. We do not suppress images with the same digest that are aliased by the alias tag but are not its primary target, on the somewhat tenuous grounds that the description of the alias will not mention that image and it may seem strange for it to go missing.hide_resolved_aliases (
bool
, default:False
) – IfTrue
, hide images that are an alias for another image in the collection (but keep alias images when we don’t have the target). This is used to suppress the alias images when reporting prepull status, where the underlying images are more useful to report.
- Returns:
Images sorted by their type and then in reverse by their version.
- Return type:
- image_for_digest(digest)¶
Find an image by digest.
Returns the non-alias image by preference, although if an alias image has not been resolved with a target, we may return the unresolved alias.
- image_for_tag_name(tag)¶
Find an image by tag name.
- latest(image_type)¶
Get the latest image of a given type.
- Parameters:
image_type (
RSPImageType
) – Image type to retrieve.- Returns:
Latest image of that type, if any.
- Return type:
RSPImage or None
- mark_image_seen_on_node(digest, node, image_size=None)¶
Mark an image as seen on a node.
This is implemented by the image collection so that we can update all of the image’s aliases as well.
- subset(*, releases=0, weeklies=0, dailies=0, include=None)¶
Return a subset of the image collection.
- Parameters:
- Returns:
The desired subset.
- Return type:
- subtract(other)¶
Find the list of images in this collection missing from another.
This returns only one image per digest, preferring the non-alias images, since the intended use is for determining what images to prepull, and there’s no need to prepull the same image more than once under different names.
- Parameters:
other (
RSPImageCollection
) – The other collection, whose contents will be subtracted from this one.- Returns:
All images found in this collection that weren’t in the other. Images are considered matching only if their digests match.
- Return type: