devops_utils.init module

Implements initialization process for a devops-utils container.

The main() here is the entrypoint of the devops-utils image. It parses the arguments and delegates execution to appropriate handler (either run() or devops_utils.install.install()).

Function run() handles initializing the environment, correspondingly to what the external runner has set up by passing appropriate options to docker.

initfunc() is a decorator that registers a function to be executed during init (from run()).

devops_utils.init.initfunc()

Register decorated function as initializer.

An initializer is executed on startup and can contribute to environment setup within the container. The function signature should be:

devops_utils.init.func(prog : string, args : list) → None
Parameters:
  • prog (str) – name/path to the program that will be executed by init
  • args (list) – arguments it will be executed with; may be mutated to affect the final arguments
devops_utils.init.install_file(src, dst, owner, group, mode)[source]

Install a file, set permissions and ownership.

Parameters:
  • src (str) – path to the source
  • dst (str) – path to the destination
  • owner (str) – owner username
  • group (str) – group name
  • mode (int) – mode to set on the destination
devops_utils.init.install_file_if_exists(src, dst, owner, group, mode)[source]

Install a file like install_file() if source exists.

devops_utils.init.main(args=['-T', '-E', '-b', 'readthedocs', '-d', '_build/doctrees-readthedocs', '-D', 'language=en', '.', '_build/html'])[source]

Run a program in devops-utils container.

devops_utils.init.run(prog, args)[source]

Run the specified program.