Package VMBuilder :: Module util
[frames] | no frames]

Module util

source code

Classes
  NonBlockingFile
Functions
string
run_cmd(*argv, **kwargs)
Runs a command.
source code
 
checkroot()
Check if we're running as root, and bail out if we're not.
source code
 
render_template(plugin, context, tmplname, extra_context=None) source code
 
call_hooks(context, func, *args, **kwargs) source code
 
log_no_such_method(*args, **kwargs) source code
 
tmp_filename(suffix='', tmp_root=None) source code
 
tmpdir(suffix='', tmp_root=None) source code
 
set_up_tmpfs(tmp_root=None, size=1024)
Sets up a tmpfs storage under `tmp_root` with the size of `size` MB.
source code
 
clean_up_tmpfs(mount_point)
Unmounts a tmpfs storage under `mount_point`.
source code
 
get_conf_value(context, confparser, key) source code
 
apply_config_files_to_context(config_files, context) source code
Variables
  __package__ = 'VMBuilder'
Function Details

run_cmd(*argv, **kwargs)

source code 

Runs a command.

Locale is reset to C to make parsing error messages possible.

Parameters:
  • stdin (string) - input to provide to the process on stdin. If None, process' stdin will be attached to /dev/null
  • ignore_fail (boolean) - If True, a non-zero exit code from the command will not cause an exception to be raised.
  • env (dict) - Dictionary of extra environment variables to set in the new process
Returns: string
string containing the stdout of the process

set_up_tmpfs(tmp_root=None, size=1024)

source code 

Sets up a tmpfs storage under `tmp_root` with the size of `size` MB.

`tmp_root` defaults to tempfile.gettempdir().