The nova.openstack.common.processutils Module

System-level utilities and helper functions.

exception ProcessExecutionError(stdout=None, stderr=None, exit_code=None, cmd=None, description=None)

Bases: exceptions.Exception

exception UnknownArgumentError(message=None)

Bases: exceptions.Exception

execute(*cmd, **kwargs)

Helper method to shell out and execute a command through subprocess with optional retry.

Parameters:
  • cmd (string) – Passed to subprocess.Popen.
  • process_input – Send to opened process.
  • check_exit_code (int) – Defaults to 0. Will raise ProcessExecutionError if the command exits without returning this value as a returncode
  • delay_on_retry (boolean) – True | False. Defaults to True. If set to True, wait a short amount of time before retrying.
  • attempts (int) – How many times to retry cmd.
  • run_as_root (boolean) – True | False. Defaults to False. If set to True, the command is prefixed by the command specified in the root_helper kwarg.
  • root_helper (string) – command to prefix all cmd’s with
Returns:

(stdout, stderr) from process execution

Raises :

UnknownArgumentError on receiving unknown arguments

Raises :

ProcessExecutionError

Previous topic

The nova.openstack.common.policy Module

Next topic

The nova.openstack.common.rootwrap.filters Module

This Page