backend.helpers¶
-
backend.helpers.
pyconffile
(filename)[source]¶ Load python file as configuration file, inspired by python-flask “from_pyfile()
-
backend.helpers.
run_cmd
(cmd, shell=False)[source]¶ Runs given command in a subprocess.
- cmd: list(str) or str if shell==True
command to be executed and its arguments
- shell: bool
if the command should be interpreted by shell
- munch.Munch(stdout, stderr, returncode)
executed cmd, standard output, error output, and the return code
-
backend.helpers.
wait_log
(log, reason="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
-
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.
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.
utc_now
()[source]¶ - Return datetime.datetime
Current utc datetime with specified timezone