libioc.Filter module

ioc filters for ListableResource.

class libioc.Filter.Term(key, values=[])[source]

Bases: list

A single filter term.

glob_characters = ['*', '+']
matches(value, short=False)[source]

Return True if the value matches the term.

Parameters
  • value (Any) – The value that is matched against the filter term

  • short (bool) – When value has a length of 8 characters, this argument allows to match a jail’s shortname as well. This is required for selecting jails with UUIDs by the first part of the name

Return type

bool

matches_resource(resource)[source]

Return True if the term matches the resource.

Return type

bool

property short

Return True if the short name of a UUID be used.

Return type

bool

class libioc.Filter.Terms(terms=None, logger=None)[source]

Bases: list

A group of filter terms.

Each item in this group must match for a resource to pass the filter. This can be interpreted as logical AND

add(term)[source]

Add a Term to the list of Terms.

Parameters

term (libioc.Filter.Term, str) – Interface name inside the jail

Return type

None

match_key(key, value)[source]

Check if a value matches for a given key.

Returns True if the given value matches all terms for the specified key Returns Fals if one of the terms does not match

Return type

bool

match_resource(resource)[source]

Return True if all Terms match the resource.

Return type

bool

match_source(source_name)[source]

Check if the source name matches the filter terms.

Return type

bool

set(terms)[source]

Clear and set all terms from input data.

Return type

None

libioc.Filter.match_filter(value, filter_string)[source]

Return True when the value matches the filter string.

Return type

bool