SCAutolib
Functions
- run(cmd, stdout=-1, stderr=-1, check=True, print_=True, return_code=None, sleep=0, **kwargs)[source]
Wrapper for subrpocess.run function. This function explicitly set several parameter of original function and also provides similar thing as subprocess.check_output do. But with having this wrapper, functionality of this two functions is generalized and can be changed by setting corresponding parameters. If there are any specific parameter of subprocess.run function needed to be passed to this wrapper, you can do it by adding same parameters names in key=value format.
- Parameters:
sleep (int) – time to sleep after command is executed
return_code (list) – acceptable return codes from given commands. If check=True, and the return code of the cmd is not in the return_code list a subprocess.CalledProcessError exception would be raised.
stdout (None or int or IO) – Redirection of stdout. Default is subprocess.PIPE
stderr (None or int or IO) – Redirection of stderr. Default is subprocess.PIPE
check (bool) – Specifies it return code of the command would be checked for 0 (if return code == 0). If True and return code is not 0, then subprocess.CalledProcessError exception would be risen. Default is False.
print (bool) – Specifies it stdout and stderr should be printed to the terminal. Log message with stdout would have debug type and stderr log message would have error type. Default is True.
kwargs – Other parameters to subprocess.run function
- Raises:
- Returns:
Completed process from subprocess.run
- Return type:
Modules
Implementation of CLI commands for SCAutolib. |
|
Exceptions that are used in the SCAutolib |
|
This module provides a function (isDistro) that helps us identify the os of the system and configure the system accordingly. |
|
Implementation of models for SCAutolib. |
|
This module provides a set of additional helping functions that are used across the library. |