backend.helpers

backend.helpers.run_cmd(cmd)[source]

Runs given command in a subprocess.

cmd: list(str)
command to be executed and its arguments
munch.Munch(stdout, stderr, returncode)
executed cmd, standard output, error output, and the return code
backend.helpers.run_ssh(cmd, user, ip)[source]

Runs given command through ssh on a remote machine.

cmd
: list(str)
command to be executed with ssh
user: str
user to connect with
ip: str
ip address of the remote machine
munch.Munch(stdout, stderr, returncode)
standard output, error output, and the return code from ssh
backend.helpers.wait_log(log, reason=u"I don't know why.", timeout=5)[source]

We need to wait a while, this should happen only when copr converges to boot-up/restart/..

class backend.helpers.SortedOptParser(usage=None, option_list=None, option_class=<class optparse.Option>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None, epilog=None)[source]

Optparser which sorts the options by opt before outputting –help

format_help(formatter=None)[source]
backend.helpers._get_conf(cp, section, option, default, mode=None)[source]

To make returning items from config parser less irritating

Parameters:mode – convert obtained value, possible modes: - None (default): do nothing - “bool” or “boolean” - “int” - “float”
backend.helpers.chroot_to_branch(chroot)[source]

Get a git branch name from chroot. Follow the fedora naming standard.

class backend.helpers.BackendConfigReader(config_file=None, ext_opts=None)[source]
read()[source]
_read_unsafe()[source]
backend.helpers.get_auto_createrepo_status(front_url, username, projectname)[source]
backend.helpers.get_persistent_status(front_url, username, projectname)[source]
backend.helpers.get_auto_prune_status(front_url, username, projectname)[source]
backend.helpers.register_build_result(opts=None, failed=False)[source]

Remember fails to redis. Successful build resets counter to zero.

Parameters:
  • opts – BackendConfig, when opts not provided default config location will be used
  • failed (boolean) – failure flag
  • origin (str) – name of component produced failure, default: builder
backend.helpers.get_redis_connection(opts)[source]

Creates redis client object using backend config

Return type:StrictRedis
backend.helpers.format_tb(ex, ex_traceback)[source]
class backend.helpers.RedisPublishHandler(rc, who, level=0)[source]
emit(record)[source]
backend.helpers.get_redis_logger(opts, name, who)[source]
backend.helpers.create_file_logger(name, filepath, fmt=None)[source]
backend.helpers.utc_now()[source]
Return datetime.datetime:
 Current utc datetime with specified timezone
backend.helpers.silent_remove(filename)[source]
backend.helpers.get_backend_opts()[source]
backend.helpers.ensure_dir_exists(path, log)[source]
backend.helpers.get_chroot_arch(chroot)[source]
backend.helpers.local_file_logger(*args, **kwds)[source]