toxicbuild.ui package

Submodules

toxicbuild.ui.cli module

class toxicbuild.ui.cli.HistoryEdit(*args, **kwargs)[source]

Bases: toxicbuild.ui.cli.HistoryEditMixin, urwid.widget.Edit

class toxicbuild.ui.cli.HistoryEditMixin(*args, **kwargs)[source]

Bases: object

append_to_history(item)[source]
get_next()[source]
get_previous()[source]
keypress(size, key)[source]
save_history()[source]
class toxicbuild.ui.cli.ToxicCli(host='localhost', port=6666, token=None)[source]

Bases: toxicbuild.ui.cli.ToxicCliActions, urwid.decoration.Filler

execute_and_show(cmdline)[source]

Executes an action requested by the user and show its output.

get_action_help_screen(action, full=True)[source]

Returns a list already formated to be displayed by self.main_screen as the help for a command.

get_help_screen(command_name=None)[source]
keypress(size, key)[source]
peek()[source]

Peeks throught the master’s hole.

quit()[source]
run()[source]
show_welcome_screen()[source]

Displays the welcome screen for toxiccli.

stop_peek()[source]
class toxicbuild.ui.cli.ToxicCliActions(*args, host='localhost', port=6666, token=None, **kwargs)[source]

Bases: object

execute_action(cmdline)[source]

Execute some action based on the cmdline inputted by the user.

get_action_from_command_line(cmdline)[source]

Returns cmdname and cmdkwargs.

get_action_help(action_name)[source]
get_actions()[source]

Asks the server for which actions are available.

get_client()[source]

Returns a client connected to a toxicbuild master

exception toxicbuild.ui.cli.ToxicShellError[source]

Bases: Exception

toxicbuild.ui.cli.get_kwargs(command_params, args)[source]

Return kwargs for args based on command_params. command_params are the known parameters for a command, those sent by list-funcs.

toxicbuild.ui.cli.parse_cmdline(cmdline)[source]

Parses a command line from toxicshell. Returns action, args, kwargs for the command line.

Parameters:cmdline – Input from the user as a string.
toxicbuild.ui.cli.validate_input(command_params, user_args, user_kwargs)[source]

Validates args and kwargs from the user input against the args and kwargs of a known command.

Parameters:
  • command_params – Known parameters for the command.
  • user_args – Argument list submitted by the user.
  • user_kwargs – Keyword arguments submitted by the user.

toxicbuild.ui.client module

class toxicbuild.ui.client.UIHoleClient(*args, hole_token=None)[source]

Bases: toxicbuild.core.client.BaseToxicClient

connect2stream()[source]

Connects the client to the master’s hole stream.

request2server(action, body)[source]
toxicbuild.ui.client.get_hole_client(host, port, hole_token=None)[source]

toxicbuild.ui.context_processors module

class toxicbuild.ui.context_processors.ToxicWebMainContextProcessor(request)[source]

Bases: pyrocumulus.web.template.ContextProcessor

get_context()[source]

toxicbuild.ui.inutils module

toxicbuild.ui.models module

class toxicbuild.ui.models.BaseModel(ordered_kwargs)[source]

Bases: object

classmethod get_client()[source]

Returns a client connected to master.

references = {}
to_dict()[source]

Transforms a model into a dict.

to_json()[source]

Transforms a model into a json.

class toxicbuild.ui.models.Build(ordered_kwargs)[source]

Bases: toxicbuild.ui.models.BaseModel

references = {'steps': <class 'toxicbuild.ui.models.Step'>, 'builder': <class 'toxicbuild.ui.models.Builder'>}
class toxicbuild.ui.models.BuildSet(*args, **kw)[source]

Bases: toxicbuild.ui.models.BaseModel

classmethod list(repo_name=None)[source]

Lists buildsets. If repo_name only builds of this repsitory will be listed.

Parameters:repo_name – Name of a repository.
references = {'builds': <class 'toxicbuild.ui.models.Build'>}
class toxicbuild.ui.models.Builder(ordered_kwargs)[source]

Bases: toxicbuild.ui.models.BaseModel

classmethod list(**kwargs)[source]

Lists builders already used.

class toxicbuild.ui.models.Plugin(ordered_kwargs)[source]

Bases: toxicbuild.ui.models.BaseModel

A repository plugin.

classmethod get(name)[source]

Return the schema for a specific plugin

Parameters:name – The name of the plugin
classmethod list()[source]

Lists all plugins available in the master.

class toxicbuild.ui.models.Repository(ordered_kwargs)[source]

Bases: toxicbuild.ui.models.BaseModel

Class representing a repository.

classmethod add(name, url, vcs_type, update_seconds=300, slaves=[], parallel_builds=None)[source]

Adds a new repository.

Parameters:
  • name – Repository’s name.
  • url – Repository’s url.
  • vcs_type – VCS type used on the repository.
  • update_seconds – Interval to update the repository code.
  • slaves – List with slave names for this reporitory.
Params parallel_builds:
 

How many paralles builds this repository executes. If None, there is no limit.

add_branch(branch_name, notify_only_latest)[source]

Adds a branch config to a repositoiry.

Parameters:
  • branch_name – The name of the branch.
  • notify_only_latest – If we should create builds for all revisions or only for the lastest one.
add_slave(slave)[source]

Adds a slave to the repository.

Parameters:slave – A Slave instance.
delete()[source]

Delete a repository.

disable_plugin(**kwargs)[source]

Disables a plugin from a repository.

Parameters:kwargs – kwargs to match the plugin.
enable_plugin(plugin_name, **kwargs)[source]

Enables a plugin to a repository.

Parameters:
  • plugin_name – The plugin’s name.
  • kwargs – kwargs used to configure the plugin.
classmethod get(**kwargs)[source]

Returns a repository.

Parameters:kwargs – kwargs to get the repository.
classmethod list()[source]

Lists all repositories.

references = {'plugins': <class 'toxicbuild.ui.models.Plugin'>, 'slaves': <class 'toxicbuild.ui.models.Slave'>}
remove_branch(branch_name)[source]

Removes a branch config from a repository.

Parameters:branch_name – The name of the branch.
remove_slave(slave)[source]

Removes a slave from the repository.

Parameters:slave – A Slave instance.
start_build(branch, builder_name=None, named_tree=None, slaves=[])[source]

Starts a (some) build(s) for a repository.

Parameters:
  • branch – The name of the branch.
  • builder_name – The name of the builder that will execute the build
  • named_tree – The named_tree that will be builded. If no named_tree the last one will be used.
  • slaves – A list with names of slaves that will execute the builds. If no slave is supplied all will be used.
to_dict()[source]

Transforms a repository into a dictionary.

update(**kwargs)[source]

Updates a slave

class toxicbuild.ui.models.Slave(ordered_kwargs)[source]

Bases: toxicbuild.ui.models.BaseModel

classmethod add(name, host, port, token)[source]

Adds a new slave.

Parameters:
  • name – Slave name.
  • host – Slave host.
  • port – Slave port.
  • token – Authentication token.
delete()[source]

Delete a slave.

classmethod get(**kwargs)[source]

Returns a slave.

Parameters:kwargs – kwargs to get the slave.
classmethod list()[source]

Lists all slaves.

update(**kwargs)[source]

Updates a slave

class toxicbuild.ui.models.Step(ordered_kwargs)[source]

Bases: toxicbuild.ui.models.BaseModel

toxicbuild.ui.web module

class toxicbuild.ui.web.BaseModelHandler(application, request, **kwargs)[source]

Bases: toxicbuild.ui.web.LoggedTemplateHandler

add(**kwargs)[source]
delete(*args)[source]
get(*args)[source]
get_item(**kwargs)[source]
initialize(*args, **kwargs)[source]
item_template = 'item.html'
list_template = 'list.html'
post(*args)[source]
class toxicbuild.ui.web.LoggedTemplateHandler(application, request, **kwargs)[source]

Bases: pyrocumulus.web.handlers.TemplateHandler

prepare()[source]
class toxicbuild.ui.web.LoginHandler(application, request, **kwargs)[source]

Bases: pyrocumulus.web.handlers.TemplateHandler

get(action)[source]
post(action)[source]
class toxicbuild.ui.web.MainHandler(application, request, **kwargs)[source]

Bases: toxicbuild.ui.web.LoggedTemplateHandler

get()[source]
main_template = 'main.html'
class toxicbuild.ui.web.RepositoryHandler(application, request, **kwargs)[source]

Bases: toxicbuild.ui.web.BaseModelHandler

add_branch()[source]
delete(*args)[source]
disable_plugin()[source]
enable_plugin()[source]
list_plugins()[source]
post(*args)[source]
prepare()[source]
put(*args)[source]
remove_branch()[source]
start_build()[source]
class toxicbuild.ui.web.SlaveHandler(application, request, **kwargs)[source]

Bases: toxicbuild.ui.web.BaseModelHandler

delete(*args)[source]
prepare()[source]
put(*args)[source]
class toxicbuild.ui.web.StreamHandler(application, request, **kwargs)[source]

Bases: toxicbuild.core.utils.LoggerMixin, tornado.websocket.WebSocketHandler

initialize()[source]
on_close()[source]
open(action)[source]
receiver(sender, **message)[source]
write2sock(body)[source]
class toxicbuild.ui.web.WaterfallHandler(application, request, **kwargs)[source]

Bases: toxicbuild.ui.web.LoggedTemplateHandler

get(repo_name)[source]
prepare()[source]
template = 'waterfall.html'

Module contents

toxicbuild.ui.create(root_dir, access_token, username=None, password=None)[source]

Create a new toxicweb project.

Parameters:
  • --root_dir – Root directory for toxicweb.
  • --access-token – Access token to master’s hole.
  • --username – Username for web access
  • --password – Password for web access
toxicbuild.ui.create_settings()[source]
toxicbuild.ui.restart(workdir, pidfile=None)[source]

Restarts toxicslave

The instance of toxicweb in workdir will be restarted. :param workdir: Workdir for master to be killed. :param –pidfile: Name of the file to use as pidfile.

toxicbuild.ui.start(workdir, daemonize=False, stdout='./toxicui.log', stderr='./toxicui.log', pidfile=None, loglevel='info', conffile=None)[source]

Starts the web interface.

Starts the build server to listen on the specified port for requests from addr (0.0.0.0 means everyone). Addr and port params came from the configfile

Parameters:
  • workdir – Work directory for server.
  • --daemonize – Run as daemon. Defaults to False
  • --stdout – stdout path. Defaults to /dev/null
  • --stderr – stderr path. Defaults to /dev/null
  • --pidfile – pid file for the process.
  • --loglevel – Level for logging messages. Defaults to info.
  • --conffile (-c,) – path to config file. It must be relative to the workdir. Defaults to None. If not conffile, will look for a file called toxicui.conf inside workdir
toxicbuild.ui.stop(workdir, pidfile=None)[source]

Stops the web interface.

Parameters:
  • workdir – Work directory for the ui to be killed.
  • --pidfile – pid file for the process.