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

Module util

source code

Classes
  NonBufferedFile
Functions
string
run_cmd(*argv, **kwargs)
Runs a command.
source code
 
give_to_caller(path)
Change ownership of file to $SUDO_USER.
source code
 
checkroot()
Check if we're running as root, and bail out if we're not.
source code
 
fix_ownership(files)
Goes through files and fixes their ownership of them.
source code
 
render_template(plugin, vm, tmplname, context=None) source code
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

give_to_caller(path)

source code 

Change ownership of file to $SUDO_USER.

Parameters:
  • path (string) - file or directory to give to $SUDO_USER

fix_ownership(files)

source code 

Goes through files and fixes their ownership of them.

Parameters:
  • files (list) - files whose ownership should be fixed up (currently simply calls give_to_caller)