ODCS client Python module

class odcs.client.odcs.ComposeSourceBuild(builds, sigkeys=None, **kwargs)[source]

Compose source taking list of Koji builds as input.

Creates new ComposeSourceModule instance.

Parameters:
  • builds (list) – List of NVRs of Koji builds to be included in the compose.

  • sigkeys (list) – List of signature keys by which the RPMs in the compose must be signed. Empty string in the list allows unsigned packages.

class odcs.client.odcs.ComposeSourceModule(modules, sigkeys=None, module_defaults_url=None, module_defaults_commit=None, scratch_modules=None, **kwargs)[source]

Compose source taking list of modules as input.

Creates new ComposeSourceModule instance.

Parameters:
  • modules (list) – List of modules in N:S, N:S:V or N:S:V:C format.

  • sigkeys (list) – List of signature keys by which the RPMs in the compose must be signed. Empty string in the list allows unsigned packages.

  • module_defaults_url (str) – URL of module defaults repository.

  • module_defaults_commit (str) – Commit or branch name defining particular point module defaults repository.

  • scratch_modules (list) – List of N:S:V:C of scratch modules to be included in the compose.

class odcs.client.odcs.ComposeSourcePulp(content_sets, **kwargs)[source]

Compose source taking list of Pulp content_sets as input.

Creates new ComposeSourcePulp instance.

Parameters:

content_sets (list) – List of Pulp content-sets. Repositories defined by these content-sets will be included in the compose.

class odcs.client.odcs.ComposeSourceRawConfig(config_name, commit, koji_event=None, **kwargs)[source]

Compose source taking raw Pungi configuration file as input.

Creates new ComposeSourceRawConfig instance.

Parameters:
  • config_name (str) – The name of Raw Pungi configuration as configured in ODCS server.

  • commit (str) – The commit hash or branch to get the Pungi configuration from.

  • koji_event (int) – Particular Koji event id to generate compose from. If unset, latest Koji event will be used.

class odcs.client.odcs.ComposeSourceTag(tag, packages=None, builds=None, sigkeys=None, koji_event=None, modular_koji_tags=None, module_defaults_url=None, module_defaults_commit=None, scratch_modules=None, **kwargs)[source]

Compose source taking Koji tag as input.

Creates new ComposeSourceTag instance.

Parameters:
  • tag (str) – Koji tag to use as a source for compose.

  • packages (list) – List of Koji packages to include in the compose. Note that this is not a list of RPM names. If unset, all packages tagged in the Koji tag will be included in a compose.

  • builds (list) – List of NVRs of Koji builds to be included in the compose on top of the Koji builds directly tagged in the Koji tag. If unset, only Koji builds tagged in the Koji tag will be used.

  • sigkeys (list) – List of signature keys by which the RPMs in the compose must be signed. Empty string in the list allows unsigned packages.

  • koji_event (int) – Particular Koji event id to generate compose from. If unset, latest Koji event will be used.

  • modular_koji_tags (list) – List of Koji tags containing modules which should also be included in the resulting compose on top of Koji builds tagged in the Koji tag.

  • module_defaults_url (str) – URL of module defaults repository.

  • module_defaults_commit (str) – Commit or branch name defining particular point module defaults repository.

  • scratch_modules (list) – List of N:S:V:C of scratch modules to be included in the compose.

class odcs.client.odcs.ODCS(server_url, api_version='1', verify_ssl=True, auth_mech=None, openidc_token=None, ssl_cert=None, ssl_key=None)[source]

Client API to interact with ODCS APIs

Initialize ODCS client

Parameters:
  • server_url (str) – server URL of ODCS.

  • api_version (str) – API version client will call. Version 1 is the default.

  • verify_ssl (bool) – whether to verify SSL certificate over HTTP. By default, always verify, but you are also always able to disable it by passing False.

  • auth_mech (AuthMech) – specify what authentication mechanism is used to interact with ODCS server. Choose one mechanism from AuthMech. Anonymous can be passed to force client not send any authentication information. If this parameter is omitted, same as Anonymous.

  • openidc_token (str) – token got from OpenIDC so that client can be authenticated by ODCS server. This is only required if AuthMech.OpenIDC is passed to parameter auth_mech.

  • ssl_cert (str) – Path to SSL client certificate to use. This is only required if AuthMech.SSL is passed to parameter auth_mech.

  • ssl_key (str) – Path to SSL client key to use. This is only required if AuthMech.SSL is passed to parameter auth_mech.

about()[source]

Get information about ODCS server

delete_compose(compose_id)[source]

Delete a compose

Parameters:

compose_id (int) – compose ID.

Returns:

a mapping representing the acknowledge of a compose is delete.

Return type:

dict

find_composes(**search_criteria)[source]

Find composes

Parameters:

search_criteria (dict) – a mapping containing compose search criteria and pagination arguments. Composes can be searched by owner, source_type, source and state.

Returns:

list of found composes, each of them is a dict.

Return type:

list

get_compose(compose_id)[source]

Get a compose

Parameters:

compose_id (int) – compose ID.

Returns:

a mapping representing a compose.

Return type:

dict

new_compose(source, source_type, seconds_to_live=None, packages=[], flags=[], sigkeys=None, koji_event=None, results=None, arches=None, builds=None, modular_koji_tags=None, module_defaults_url=None, module_defaults_commit=None, scratch_modules=None, lookaside_repos=None, label=None, compose_type=None)[source]

Request a new compose

Warning

This method is deprecated. Please use request_compose instead.

Parameters:
  • source (str) – from where to grab and make new compose, different value for different source_type. For tag source type, name of the tag. For module source type, white-space separated list of module name-stream or name-stream-version. For repo source type, full path to repository.

  • source_type (str) – source type. tag for compose from Koji tag, module for compose from the Fedora module, repo for compose from local RPM repository.

  • seconds_to_live (int) – Number of seconds for which the compose should become available.

  • packages (list) – List of packages to include in a compose. Must not be set for “module” source_type.

  • flags (list) – List of flags influencing the resulting compose. Valid flags are 1) no_deps, the resulting compose will contain only packages defined in the “packages” list without their dependencies, or for source_type of “module”, only the modules listed in source without their dependencies.

  • sigkeys (list) – List of signature keys by which the packages in compose must be signed.

  • koji_event (int) – Koji event for populating package set.

  • results (list) – List of additional results which will be generated by ODCS as part of this compose. Can be “iso” for iso files with packages or “boot.iso” for images/boot.iso needed to generate container base images or installable DVDs.

Returns:

the newly created Compose

Return type:

dict

renew_compose(compose_id, seconds_to_live=None, label=None)[source]

To regenerate an expired compose

Parameters:
  • compose_id (int) – Compose ID to renew.

  • label (string) – The new label of the regenerated Compose.

  • seconds_to_live (int) – Number of seconds for which the compose should become available.

Returns:

the new regenerated Compose

Return type:

dict

request_compose(source, **kwargs)[source]

Request new compose.

Example:

source = ComposeSourceTag("f32-updates", packages="httpd")
odcs = ODCS(...)
compose = odcs.request_compose(source, arches="x86_64", flags=["nodeps"])
odcs.wait_for_compose(compose["id"])
Parameters:
  • source (ComposeSourceGeneric) – The source of compose.

  • kwargs – Extra arguments passed to “/api/1/composes” POST JSON data.

Returns:

the requested Compose object.

Return type:

dict

wait_for_compose(compose_id, timeout=300, watch_logs=False)[source]

Polls the ODCS server repeatedly to find out whether the compose moved from “wait” or “generating” state to some final state. Blocks for timeout seconds. If the compose does not move to the final state in given time limit, raises RuntimeError.

NOTE: It is advised to use this method only in situations where the caller is not able to listen on Fedora messaging bus or UMB bus for the odcs.state.change messages which can inform the caller about the compose state change without the polling.

Parameters:
  • compose_id (int) – compose ID.

  • timeout (int) – Number of seconds to wait/block.

  • watch_logs (bool) – If True, this method prints the compose log to stdout every 10 seconds while waiting for the compose to finish.

Return type:

dict

Returns:

a mapping representing a compose