API Documentation

Build

class errata_tool.build.Build(nvr)[source]

Search ET for Details based on a build

Find build information and advisories where the build is attached.

Parameters:nvr – build NVR (name-version-release)
all_errata

List of all Erratas where the build is attached

Returns:list of Errata objects
all_errata_ids

List of all Errata IDs where the build is attached

Returns:list of Errata ids
files

List of file path generated by build

Returns:list of string paths
released_errata

Released Errata

Returns:Errata object
released_errata_id

Released Errata ID

Returns:Errata id
signed_rpms

Signed rpms flag

Returns:boolean True/False

ErrataConnector

class errata_tool.connector.ErrataConnector[source]
canonical_url(u)[source]
debug = False
get_paginated_data(api_url)[source]

Get data from a paginated API.

See /developer-guide/api-http-api.html#api-pagination

Loop and query api_url with an incrementing page[number] integer. When api_url returns no more paginated data, we will return all the data we found combined in one large list.

Parameters:api_url (str) – A paginated URL. This URL should return JSON with a “data” element that contains a (possibly-empty) list.
Returns:all the paginated data we found in a single list.
ssl_verify = True
timings = {'GET': {}, 'POST': {}, 'PUT': {}}

Erratum

class errata_tool.erratum.Erratum(**kwargs)[source]
addBugs(buglist)[source]
addBuilds(buildlist, **kwargs)[source]

Add Build(s) to erratum

addBuildsDirect(buildlist, release, **kwargs)[source]
addCC(email)[source]

Add someone to the CC list for this advisory.

addFlags(flags)[source]
changeDocsReviewer(login_name)[source]
commit()[source]
dump()[source]
externalTests(test_type=None)[source]

Get active external test results for this advisory.

Parameters:test_type – str, like “rpmdiff” or “covscan”
Returns:a possibly-empty list of dicts, one per result.
findMissingBuilds()[source]
fmt(s)[source]
get_erratum_data()[source]

Return the server’s JSON data for this advisory.

This returns the JSON response from the Errata Tool’s REST API /advisory/<errata_id>.json and /api/v1/erratum/<errata_id> endpoints. Use this when debugging interactions with the Errata Tool or when passing this data on to other non-Python tools.

Returns:a dict that is simply the parsed JSON from the server.
metadataCdnRepos(enable=[], disable=[])[source]

Get or set the CDN repos for this advisory.

Note: This method applies only for advisories containing Docker images.

When called with no arguments, this method returns all available CDN repos for advisory metadata. Otherwise you may enable or disable repos here.

Parameters:
  • enable – (optional) A list of CDN repos to enable. Example: [“rhel-7-server-rhceph-3-mon-rpms__x86_64”]
  • disable – (optional) A list of CDN repos to disable.
Returns:

a list of dicts about each available repo, and whether they are enabled or disabled.

push(target='stage')[source]

Push an advisory to “stage”, “live”, or both.

Parameters:target – A string “stage” or “live”. Defaults to “stage”. You can also pass a list here, [‘stage’, ‘live’] to do both in one operation.
Returns:a list describing the Errata Tool’s newly triggered push tasks. Each push task includes an “id”. You can query the status of this push ID at /api/v1/erratum/{id}/push/{push_id} .
refresh()[source]
reloadBuilds(no_rpm_listing_only=False, no_current_files_only=False)[source]
removeBugs(buglist)[source]
removeBuilds(buildlist)[source]

Remove build(s) from advisory

removeFlags(flags)[source]
setFileInfo(file_info)[source]
setState(state)[source]
syncBugs()[source]
textOnlyRepos(enable=[], disable=[])[source]

Get or set the text-only repos for this advisory.

Note: This method applies only for text-only advisories.

When called with no arguments, this method returns all available CDN repos for the advisory text. Otherwise you may enable or disable repos here.

Parameters:
  • enable – (optional) A list of CDN repos to enable. Example: [“rhel-7-server-rhceph-3-mon-rpms__x86_64”]
  • disable – (optional) A list of CDN repos to disable.
Returns:

a list of dicts about each available repo, and whether they are enabled or disabled.

update(**kwargs)[source]
url()[source]

Product

class errata_tool.product.Product(name)[source]
product_versions()[source]

Get the list of product version for this Product.

Returns:a (possibly-empty) list of ProductVersion objects.
refresh()[source]
render()[source]

ProductVersion

class errata_tool.product_version.ProductVersion(id_or_name, data=None)[source]

Find a Product Version in the ET database.

Parameters:id_or_name – This can be an id number (int) or product version name (str), for example “RHEL-7-CEPH-3”.
refresh()[source]
releasedBuilds()[source]

Get the list of released builds for this Product Version.

Returns:a (possibly-empty) list of dicts. Each dict represents a build, for example:
{'build': u'ceph-12.2.5-42.el7cp',
 'created_at': '2018-09-26T18:17:33Z',
 'errata_id': 33840,
 'updated_at': '2018-09-26T18:17:33Z'},
render()[source]
variants()[source]

Get the list of variants for this Product Version.

Returns:a (possibly-empty) list of Variant objects.

Release

class errata_tool.release.Release(**kwargs)[source]
advisories()[source]

Find all advisories for this release.

Returns:a list of dicts, one per advisory. For example: [{
”id”: 32972, “advisory_name”: “RHSA-2018:0546”, “product”: “Red Hat Ceph Storage”, “release”: “rhceph-3.0”, “synopsis”: “Important: ceph security update”, “release_date”: None, “qe_owner”: “someone@redhat.com”, “qe_group”: “RHC (Ceph) QE”, “status”: “SHIPPED_LIVE”, “status_time”: “March 15, 2018 18:29”

}]

classmethod create(name, product, product_versions, type, program_manager, default_brew_tag, blocker_flags, ship_date=None)[source]

Create a new release in the ET.

See https://bugzilla.redhat.com/1401608 for background.

Note this method enforces certain conventions: * Always disables PDC for a release * Always creates the releases as “enabled” * Always allows multiple advisories per package * Description is always the combination of the product’s own

description (for example “Red Hat Ceph Storage”) with the number from the latter part of the release’s name. So a new “rhceph-3.0” release will have a description “Red Hat Ceph Storage 3.0”.
Parameters:
  • name – short name for this release, eg “rhceph-3.0”
  • product – short name, eg. “RHCEPH”.
  • product_versions – list of names, eg. [“RHEL-7-CEPH-3”]
  • type – “Zstream” or “QuarterlyUpdate”
  • program_manager – for example “anharris” (Drew Harris, Ceph PgM)
  • default_brew_tag – for example “ceph-3.0-rhel-7-candidate”
  • blocker_flags – for example, “ceph-3.0”
  • ship_date – date formatted as strftime(“%Y-%b-%d”). For example, “2017-Nov-17”. If ommitted, the ship_date will be set to today’s date. (This can always be updated later to match the ship date value in Product Pages.)
refresh()[source]

User

class errata_tool.user.User(id_or_login_name)[source]

Find a user in the ET database.

Parameters:id_or_login_name – This can be an id number (int) or login name (str). The user’s login name should be passed without “@redhat.com”, eg. “anharris”.