Directives Modules

Directives are basically Python modules which help you with some specific functionality that is either common for many tasks, or non-trivial to do and therefore saves you the work of implementing it. They offer more functionality than our libtaskotron API, but the basic API might be sufficient for you needs, have a look at both.

Note

In older libtaskotron versions the directives were used in a different way than standard Python modules, but that is no longer the case. Until they are re-implemented into standard-looking modules, they are somewhat awkward to use, nevertheless they are functional.

Using directives

We’ll use the Koji directive in the following example, but it applies to any of them. This is how to download a single RPM using the Koji directive:

from libtaskotron.directives import koji_directive
koji = koji_directive.KojiDirective()
params = {'action': 'download',
          'koji_build': 'htop-2.0.2-4.fc27.x86_64',
          'arch': 'all',
          'src': True,
          'target_dir': '/tmp/rpms',
          }
koji.process(params, None)

First, you need to import the module. Then, create a new instance of the included class (named in CamelCase from the file name). Then, you need to construct a dictionary with mandatory and optional keyvals defined in the directive documentation. Finally, you call the process() method with the dictionary and a second None argument.

Available modules

bodhi

download updates from Bodhi

create_report

generate a report of task results

createrepo

create a YUM repository from RPM packages using createrepo_c

distgit

download files from distgit

dummy

test how directives work

exitcode

set runtask exit code based on last or worst test outcome

koji

download builds and tags from Koji

xunit

parse an xUnit XML file into the ResultYAML format

yumrepoinfo

translate Koji tags into YUM repository URLs