Handlers

Project

class copr.client_v2.handlers.ProjectHandle(client, nc, root_url, projects_href)[source]
get_list(search_query=None, owner=None, name=None, limit=None, offset=None)[source]

Retrieves projects object according to the given parameters

Parameters:
  • search_query (str) – search projects with such string
  • owner (str) – owner username
  • name (str) – project name
  • limit (int) – limit number of projects
  • offset (int) – number of projects to skip
Return type:

ProjectList

get_one(project_id)[source]

Retrieves project object.

Parameters:project_id (int) – project identifier
Return type:Project
create(name, owner, chroots, description=None, instructions=None, homepage=None, contact=None, disable_createrepo=None, build_enable_net=None, repos=None)[source]

Creates new project

Parameters:
  • name – project name
  • owner – username
  • chroots – list of mock chroot to be used in project
  • description
  • instructions
  • homepage
  • contact
  • disable_createrepo (bool) –
  • build_enable_net (bool) –
  • repos – list of additional repos enabled for builds
Return type:

Project

update(project_entity)[source]

Updates project.

Parameters:project_entity (ProjectEntity) – project entity to use for update
Return type:OperationResult
delete(project_id)[source]

Deletes project.

Parameters:project_id (int) – project identifier
Return type:OperationResult
get_builds_handle()[source]
Return type:BuildHandle
get_build_tasks_handle()[source]
Return type:BuildTasksHandle
get_project_chroots_handle()[source]
Return type:ProjectChrootHandle

Project chroot

class copr.client_v2.handlers.ProjectChrootHandle(client, nc, root_url)[source]
get_base_url(project, **kwargs)[source]
get_one(project, name)[source]

Retrieves project chroot object.

Parameters:
  • project (Project) – parent project for the chroot
  • name (str) – chroot name
Return type:

ProjectChroot

get_list(project)[source]

Retrieves project chroot list object.

Parameters:project (Project) – parent project for the chroot
Return type:ProjectChrootList
disable(project, name)[source]

Disables one chroot for the project

Parameters:
  • project (Project) – parent project for the chroot
  • name (str) – chroot name to disable
enable(project, name, buildroot_pkgs=None)[source]

Enables one chroot for the project

Parameters:
  • project (Project) – parent project for the chroot
  • name (str) – chroot name to enable
Params buildroot_pkgs:
 

packages to add into the buildroot

Return type:

OperationResult

update(project, chroot_entity)[source]
Parameters:chroot_entity (entities.ProjectChrootEntity) – Entity to update
Return type:OperationResult

Build

class copr.client_v2.handlers.BuildHandle(client, nc, root_url, builds_href)[source]
get_one(build_id)[source]

Retrieves builds object

Parameters:build_id (int) – id of the target build
Return type:Build
get_list(project_id=None, owner=None, limit=None, offset=None)[source]

Retrieves builds object according to the given parameters

Parameters:
  • owner – name of the project owner
  • project_id – id of the project
  • limit – limit number of builds
  • offset – number of builds to skip
Return type:

BuildList

cancel(build_entity)[source]

Cancels the given build

Parameters:build_entity (BuildEntity) – build entity to delete
Return type:OperationResult
delete(build_id)[source]

Deletes the given build

Parameters:build_id (int) – build id to delete
Return type:OperationResult
create_from_url(project_id, srpm_url, chroots=None, enable_net=True)[source]

Creates new build using public url to the srpm file

Parameters:
  • project_id (int) – id of the project where we want to submit new build
  • srpm_url (str) – url to the source rpm
  • chroots (list) – which chroots should be used during the build
  • enable_net (bool) – allows to disable network access during the build, default: True
Returns:

created build

Return type:

Build

create_from_file(project_id, file_path=None, file_obj=None, file_name=None, chroots=None, enable_net=True)[source]

Creates new build using srpm upload, please specify either file_path or (file_obj, file_name ).

Parameters:
  • project_id (int) – id of the project where we want to submit new build
  • file_path (str) – path to the srpm file
  • file_obj (file) – file-like object to read from
  • file_name (str) – name for the uploaded file
  • chroots (list) – which chroots should be used during the build
  • enable_net (bool) – allows to disable network access during the build, default: True
Returns:

created build

Return type:

Build

get_build_tasks_handle()[source]
Return type:BuildTasksHandle

Build task

class copr.client_v2.handlers.BuildTaskHandle(client, nc, root_url, build_tasks_href)[source]
get_list(owner=None, project_id=None, build_id=None, state=None, offset=None, limit=None)[source]

Retrieves build tasks list according to the given parameters

Parameters:
  • owner (str) – build tasks from the project owner by this user
  • project_id (int) – get tasks only from this project, when used query parameter owner is ignored
  • build_id (int) – get tasks only from this build, when used query parameters owner and project_id are ignored
  • state (str) – get build tasks only with this state, allowed values: failed, succeeded, canceled, running, pending, starting, importing
  • limit (int) – limit number of projects
  • offset (int) – number of projects to skip
Return type:

BuildTaskList

get_one(build_id, chroot_name)[source]

Retrieves single build task object

Parameters:
  • build_id (int) – id of the build
  • chroot_name (str) – name of the build chroot
Return type:

BuildTask

Mock chroot

class copr.client_v2.handlers.MockChrootHandle(client, nc, root_url, href)[source]
get_one(name)[source]

Retrieves mock chroot object.

Parameters:name (str) – chroot name
Return type:MockChroot
get_list(active_only=True)[source]

Retrieves mock chroot list object.

Parameters:active_only (bool) – when True, shows only chroots which can be used for builds
Return type:MockChrootList