iripau.command package¶
Module contents¶
Extension to the subprocess module to execute commands in different ways
This module relies on the following system utilities being installed: * sh * ssh * sshpass * stty * sudo
- iripau.command.user_cmd(user, cmd, alias=None, env=None, current=None)[source]¶
Return the final cmd so that the original cmd gets executed as the desired user. Same thing for alias.
Assume current user has password-less sudo.
Return the updated cmd and alias.
- iripau.command.local_args(args, *, executable=None, stdin=None, stdout=None, stderr=None, cwd=None, env=None, user=None, encoding=None, errors=None, text=True, stdout_tees=[], add_global_stdout_tees=True, stderr_tees=[], add_global_stderr_tees=True, prompt_tees=[], add_global_prompt_tees=True, echo=None, alias=None, input=None, capture_output=False, timeout=120, check=False, sigterm_timeout=10)[source]¶
Return the subprocess.run kwargs for a command to be run locally
- iripau.command.shell_cmd(cmd, alias=None, user=None, cwd=None, env=None)[source]¶
Return the final cmd so that the original cmd can be executed in the shell. Same thing for alias.
Return the updated cmd and alias.
- iripau.command.ssh_cmd(host, cmd, alias=None, user=None, cwd=None, env=None, args=[], password=None)[source]¶
Return the final cmd so that the original cmd can be executed through shs. Same thing for alias.
Return the updated cmd and alias.
- iripau.command.ssh_args(host, cmd, cwd=None, env=None, user=None, alias=None, ssh_user=None, ssh_password=None, ssh_args=[], add_global_ssh_args=True, **kwargs)[source]¶
Return the subprocess.run kwargs for a command to be run through ssh
- iripau.command.ssh_run_interactive(host, cmd, *args, env=None, user=None, ssh_user=None, ssh_password=None, ssh_args=[], add_global_ssh_args=True, **kwargs)[source]¶