pycloudlib.streams module

Wrapper class around Simplestreams.

class pycloudlib.streams.FilterMirror(config=None)[source]

Bases: simplestreams.mirrors.BasicMirrorWriter

Taken from sstream-query to return query result as json array.

__init__(config=None)[source]

Initialize custom Filter Mirror class.

Parameters:config – custom config to use
filter_index_entry(data, src, pedigree)
filter_item(data, src, target, pedigree)[source]

Filter items based on filter.

Parameters:
  • data – TBD
  • src – TBD
  • target – TBD
  • pedigree – TBD
Returns:

Filtered items

filter_product(data, src, target, pedigree)
filter_version(data, src, target, pedigree)
insert_index(path, src, content)
insert_index_entry(data, src, pedigree, contentsource)
insert_item(data, src, target, pedigree, contentsource)[source]

Insert item received.

src and target are top level products:1.0 data is src[‘products’][ped[0]][‘versions’][ped[1]][‘items’][ped[2]] contentsource is a ContentSource if ‘path’ exists in data or None

Parameters:
  • data – Data from simplestreams
  • src – TBD
  • target – TBD
  • pedigree – TBD
  • contentsource – TBD
insert_product(data, src, target, pedigree)
insert_products(path, target, content)
insert_version(data, src, target, pedigree)
load_products(path=None, content_id=None)[source]

Load each product.

Parameters:
  • path – path the product
  • content_id – ID of product
Returns:

dictionary of products

remove_item(data, src, target, pedigree)
remove_product(data, src, target, pedigree)
remove_version(data, src, target, pedigree)
sync(reader, path)
sync_index(reader, path=None, src=None, content=None)
sync_products(reader, path=None, src=None, content=None)
class pycloudlib.streams.Streams(mirror_url, keyring_path)[source]

Bases: object

Streams Class.

__init__(mirror_url, keyring_path)[source]

Initialize Steams Class.

query(img_filter)[source]

Query streams for latest image given a specific filter.

Parameters:img_filter – array of filters as strings format ‘key=value’
Returns:dictionary with latest image information or empty