diff --git a/pyinfra/api/arguments.py b/pyinfra/api/arguments.py index 719544847..2367ee45d 100644 --- a/pyinfra/api/arguments.py +++ b/pyinfra/api/arguments.py @@ -1,4 +1,8 @@ +from typing import Callable, Iterable, Mapping, Union + +import pyinfra from pyinfra import context, logger +from pyinfra.api.state import State from .util import get_call_location, memoize @@ -6,34 +10,42 @@ "_sudo": { "description": "Execute/apply any changes with ``sudo``.", "default": lambda config: config.SUDO, + "type": bool, }, "_sudo_user": { "description": "Execute/apply any changes with ``sudo`` as a non-root user.", "default": lambda config: config.SUDO_USER, + "type": bool, }, "_use_sudo_login": { "description": "Execute ``sudo`` with a login shell.", "default": lambda config: config.USE_SUDO_LOGIN, + "type": bool, }, "_use_sudo_password": { "description": "Whether to use a password with ``sudo`` (will ask).", "default": lambda config: config.USE_SUDO_PASSWORD, + "type": bool, }, "_preserve_sudo_env": { "description": "Preserve the shell environment when using ``sudo``.", "default": lambda config: config.PRESERVE_SUDO_ENV, + "type": bool, }, "_su_user": { - "description": "Execute/apply any changes with ``su``.", + "description": "Execute/apply any changes with this user using ``su``.", "default": lambda config: config.SU_USER, + "type": str, }, "_use_su_login": { "description": "Execute ``su`` with a login shell.", "default": lambda config: config.USE_SU_LOGIN, + "type": bool, }, "_preserve_su_env": { "description": "Preserve the shell environment when using ``su``.", "default": lambda config: config.PRESERVE_SU_ENV, + "type": bool, }, "_su_shell": { "description": ( @@ -42,14 +54,17 @@ "has nologin/similar as their login shell." ), "default": lambda config: config.SU_SHELL, + "type": str, }, "_doas": { "description": "Execute/apply any changes with ``doas``.", "defailt": lambda config: config.DOAS, + "type": bool, }, "_doas_user": { "description": "Execute/apply any changes with ``doas`` as a non-root user.", "default": lambda config: config.DOAS_USER, + "type": str, }, } @@ -71,36 +86,64 @@ def generate_env(config, value): "_shell_executable": { "description": "The shell to use. Defaults to ``sh`` (Unix) or ``cmd`` (Windows).", "default": lambda config: config.SHELL, + "type": str, }, "_chdir": { "description": "Directory to switch to before executing the command.", + "type": str, }, "_env": { "description": "Dictionary of environment variables to set.", "handler": generate_env, + "type": Mapping[str, str], }, "_success_exit_codes": { "description": "List of exit codes to consider a success.", "default": lambda config: [0], + "type": Iterable[int], + }, + "_timeout": { + "description": "Timeout for *each* command executed during the operation.", + "type": int, + }, + "_get_pty": { + "description": "Whether to get a pseudoTTY when executing any commands.", + "type": bool, + }, + "_stdin": { + "description": "String or buffer to send to the stdin of any commands.", + "type": Union[str, list, tuple], }, - "_timeout": "Timeout for *each* command executed during the operation.", - "_get_pty": "Whether to get a pseudoTTY when executing any commands.", - "_stdin": "String or buffer to send to the stdin of any commands.", } meta_kwargs = { # NOTE: name is the only non-_-prefixed argument "name": { "description": "Name of the operation.", + "type": str, }, "_ignore_errors": { "description": "Ignore errors when executing the operation.", "default": lambda config: config.IGNORE_ERRORS, + "type": bool, + }, + "_precondition": { + "description": "Command to execute & check before the operation commands begin.", + "type": str, + }, + "_postcondition": { + "description": "Command to execute & check after the operation commands complete.", + "type": str, + }, + # Lambda on the next two are to workaround a circular import + "_on_success": { + "description": "Callback function to execute on success.", + "type": lambda: Callable[[State, pyinfra.api.Host, str], None], + }, + "_on_error": { + "description": "Callback function to execute on error.", + "type": lambda: Callable[[State, pyinfra.api.Host, str], None], }, - "_precondition": "Command to execute & check before the operation commands begin.", - "_postcondition": "Command to execute & check after the operation commands complete.", - "_on_success": "Callback function to execute on success.", - "_on_error": "Callback function to execute on error.", } # Execution kwargs are global - ie must be identical for every host @@ -108,14 +151,17 @@ def generate_env(config, value): "_parallel": { "description": "Run this operation in batches of hosts.", "default": lambda config: config.PARALLEL, + "type": int, }, "_run_once": { "description": "Only execute this operation once, on the first host to see it.", "default": lambda config: False, + "type": bool, }, "_serial": { "description": "Run this operation host by host, rather than in parallel.", "default": lambda config: False, + "type": bool, }, } diff --git a/pyinfra/operations/apk.py b/pyinfra/operations/apk.py index 85277270f..7396323b2 100644 --- a/pyinfra/operations/apk.py +++ b/pyinfra/operations/apk.py @@ -10,7 +10,7 @@ @operation(is_idempotent=False) -def upgrade(available=False): +def upgrade(available: bool = False): """ Upgrades all apk packages. diff --git a/pyinfra/operations/apk.pyi b/pyinfra/operations/apk.pyi new file mode 100644 index 000000000..86f03af69 --- /dev/null +++ b/pyinfra/operations/apk.pyi @@ -0,0 +1,108 @@ +import typing +import pyinfra + +def upgrade( + available: bool = False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + update=False, + upgrade=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/apt.pyi b/pyinfra/operations/apt.pyi new file mode 100644 index 000000000..b6867a0f2 --- /dev/null +++ b/pyinfra/operations/apt.pyi @@ -0,0 +1,290 @@ +import typing +import pyinfra + +def key( + src=None, + keyserver=None, + keyid=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def repo( + src, + present=True, + filename=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def ppa( + src, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def deb( + src, + present=True, + force=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + cache_time=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def upgrade( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def dist_upgrade( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + update=False, + cache_time=None, + upgrade=False, + force=False, + no_recommends=False, + allow_downgrades=False, + extra_install_args=None, + extra_uninstall_args=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/brew.pyi b/pyinfra/operations/brew.pyi new file mode 100644 index 000000000..10e3a5785 --- /dev/null +++ b/pyinfra/operations/brew.pyi @@ -0,0 +1,212 @@ +import typing +import pyinfra + +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def upgrade( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + update=False, + upgrade=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def cask_upgrade( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def casks( + casks=None, + present=True, + latest=False, + upgrade=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def tap( + src, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/bsdinit.pyi b/pyinfra/operations/bsdinit.pyi new file mode 100644 index 000000000..8819e8f2c --- /dev/null +++ b/pyinfra/operations/bsdinit.pyi @@ -0,0 +1,42 @@ +import typing +import pyinfra + +def service( + service, + running=True, + restarted=False, + reloaded=False, + command=None, + enabled=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/choco.pyi b/pyinfra/operations/choco.pyi new file mode 100644 index 000000000..9d015b045 --- /dev/null +++ b/pyinfra/operations/choco.pyi @@ -0,0 +1,72 @@ +import typing +import pyinfra + +def packages( + packages=None, + present=True, + latest=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def install( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/dnf.pyi b/pyinfra/operations/dnf.pyi new file mode 100644 index 000000000..3ed4ed108 --- /dev/null +++ b/pyinfra/operations/dnf.pyi @@ -0,0 +1,186 @@ +import typing +import pyinfra + +def key( + src, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def repo( + src, + present=True, + baseurl=None, + description=None, + enabled=True, + gpgcheck=True, + gpgkey=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def rpm( + src, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + update=False, + clean=False, + nobest=False, + extra_install_args=None, + extra_uninstall_args=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/files.pyi b/pyinfra/operations/files.pyi new file mode 100644 index 000000000..40906e5f7 --- /dev/null +++ b/pyinfra/operations/files.pyi @@ -0,0 +1,459 @@ +import typing +import pyinfra + +def download( + src, + dest, + user=None, + group=None, + mode=None, + cache_time=None, + force=False, + sha256sum=None, + sha1sum=None, + md5sum=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def line( + path, + line, + present=True, + replace=None, + flags=None, + backup=False, + interpolate_variables=False, + escape_regex_characters=False, + assume_present=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def replace( + path, + text=None, + replace=None, + flags=None, + backup=False, + interpolate_variables=False, + match=None, # deprecated + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def sync( + src, + dest, + user=None, + group=None, + mode=None, + delete=False, + exclude=None, + exclude_dir=None, + add_deploy_dir=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def rsync( + src, + dest, + flags=["-ax", "--delete"], + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def get( + src, + dest, + add_deploy_dir=True, + create_local_dir=False, + force=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def put( + src, + dest, + user=None, + group=None, + mode=None, + add_deploy_dir=True, + create_remote_dir=True, + force=False, + assume_exists=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def template( + src, + dest, + user=None, + group=None, + mode=None, + create_remote_dir=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, + **data +): ... +def link( + path, + target=None, + present=True, + assume_present=False, + user=None, + group=None, + symbolic=True, + create_remote_dir=True, + force=False, + force_backup=True, + force_backup_dir=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def file( + path, + present=True, + assume_present=False, + user=None, + group=None, + mode=None, + touch=False, + create_remote_dir=True, + force=False, + force_backup=True, + force_backup_dir=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def directory( + path, + present=True, + assume_present=False, + user=None, + group=None, + mode=None, + recursive=False, + force=False, + force_backup=True, + force_backup_dir=None, + _no_check_owner_mode=False, + _no_fail_on_link=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/gem.pyi b/pyinfra/operations/gem.pyi new file mode 100644 index 000000000..6522ac556 --- /dev/null +++ b/pyinfra/operations/gem.pyi @@ -0,0 +1,39 @@ +import typing +import pyinfra + +def packages( + packages=None, + present=True, + latest=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/git.pyi b/pyinfra/operations/git.pyi new file mode 100644 index 000000000..c9d7fcf80 --- /dev/null +++ b/pyinfra/operations/git.pyi @@ -0,0 +1,165 @@ +import typing +import pyinfra + +def config( + key, + value, + repo=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def repo( + src, + dest, + branch=None, + pull=True, + rebase=False, + user=None, + group=None, + ssh_keyscan=False, + update_submodules=False, + recursive_submodules=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def worktree( + worktree, + repo=None, + detached=False, + new_branch=None, + commitish=None, + pull=True, + rebase=False, + from_remote_branch=None, + present=True, + assume_repo_exists=False, + force=False, + user=None, + group=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def bare_repo( + path, + user=None, + group=None, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/iptables.pyi b/pyinfra/operations/iptables.pyi new file mode 100644 index 000000000..5b27445e5 --- /dev/null +++ b/pyinfra/operations/iptables.pyi @@ -0,0 +1,100 @@ +import typing +import pyinfra + +def chain( + chain, + present=True, + table="filter", + policy=None, + version=4, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def rule( + chain, + jump, + present=True, + table="filter", + append=True, + version=4, + # Core iptables filter arguments + protocol=None, + not_protocol=None, + source=None, + not_source=None, + destination=None, + not_destination=None, + in_interface=None, + not_in_interface=None, + out_interface=None, + not_out_interface=None, + # After-rule arguments + to_destination=None, + to_source=None, + to_ports=None, + log_prefix=None, + # Extras and extra shortcuts + destination_port=None, + source_port=None, + extras="", + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/launchd.pyi b/pyinfra/operations/launchd.pyi new file mode 100644 index 000000000..dc62ed77a --- /dev/null +++ b/pyinfra/operations/launchd.pyi @@ -0,0 +1,40 @@ +import typing +import pyinfra + +def service( + service, + running=True, + restarted=False, + command=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/lxd.pyi b/pyinfra/operations/lxd.pyi new file mode 100644 index 000000000..6dc65fc3e --- /dev/null +++ b/pyinfra/operations/lxd.pyi @@ -0,0 +1,39 @@ +import typing +import pyinfra + +def container( + id, + present=True, + image="ubuntu:16.04", + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/mysql.pyi b/pyinfra/operations/mysql.pyi new file mode 100644 index 000000000..32a2f6ee1 --- /dev/null +++ b/pyinfra/operations/mysql.pyi @@ -0,0 +1,267 @@ +import typing +import pyinfra + +def sql( + sql, + database=None, + # Details for speaking to MySQL via `mysql` CLI + mysql_user=None, + mysql_password=None, + mysql_host=None, + mysql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def user( + user, + present=True, + user_hostname="localhost", + password=None, + privileges=None, + # MySQL REQUIRE SSL/TLS options + require=None, # SSL or X509 + require_cipher=False, + require_issuer=False, + require_subject=False, + # MySQL WITH resource limit options + max_connections=None, + max_queries_per_hour=None, + max_updates_per_hour=None, + max_connections_per_hour=None, + # Details for speaking to MySQL via `mysql` CLI via `mysql` CLI + mysql_user=None, + mysql_password=None, + mysql_host=None, + mysql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def database( + database, + # Desired database settings + present=True, + collate=None, + charset=None, + user=None, + user_hostname="localhost", + user_privileges="ALL", + # Details for speaking to MySQL via `mysql` CLI + mysql_user=None, + mysql_password=None, + mysql_host=None, + mysql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def privileges( + user, + privileges, + user_hostname="localhost", + database="*", + table="*", + flush=True, + with_grant_option=False, + # Details for speaking to MySQL via `mysql` CLI + mysql_user=None, + mysql_password=None, + mysql_host=None, + mysql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def dump( + dest, + database=None, + # Details for speaking to MySQL via `mysql` CLI + mysql_user=None, + mysql_password=None, + mysql_host=None, + mysql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def load( + src, + database=None, + # Details for speaking to MySQL via `mysql` CLI + mysql_user=None, + mysql_password=None, + mysql_host=None, + mysql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/npm.pyi b/pyinfra/operations/npm.pyi new file mode 100644 index 000000000..255363f4d --- /dev/null +++ b/pyinfra/operations/npm.pyi @@ -0,0 +1,40 @@ +import typing +import pyinfra + +def packages( + packages=None, + present=True, + latest=False, + directory=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/openrc.pyi b/pyinfra/operations/openrc.pyi new file mode 100644 index 000000000..96ecf9dd8 --- /dev/null +++ b/pyinfra/operations/openrc.pyi @@ -0,0 +1,43 @@ +import typing +import pyinfra + +def service( + service, + running=True, + restarted=False, + reloaded=False, + command=None, + enabled=None, + runlevel="default", + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/pacman.pyi b/pyinfra/operations/pacman.pyi new file mode 100644 index 000000000..5561d9b50 --- /dev/null +++ b/pyinfra/operations/pacman.pyi @@ -0,0 +1,106 @@ +import typing +import pyinfra + +def upgrade( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + update=False, + upgrade=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/pip.pyi b/pyinfra/operations/pip.pyi new file mode 100644 index 000000000..df6305a9a --- /dev/null +++ b/pyinfra/operations/pip.pyi @@ -0,0 +1,121 @@ +import typing +import pyinfra + +def virtualenv( + path, + python=None, + venv=False, + site_packages=False, + always_copy=False, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def venv( + path, + python=None, + site_packages=False, + always_copy=False, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + requirements=None, + pip="pip", + virtualenv=None, + virtualenv_kwargs=None, + extra_install_args=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/pkg.pyi b/pyinfra/operations/pkg.pyi new file mode 100644 index 000000000..7991ce499 --- /dev/null +++ b/pyinfra/operations/pkg.pyi @@ -0,0 +1,39 @@ +import typing +import pyinfra + +def packages( + packages=None, + present=True, + pkg_path=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/pkgin.pyi b/pyinfra/operations/pkgin.pyi new file mode 100644 index 000000000..6607869ce --- /dev/null +++ b/pyinfra/operations/pkgin.pyi @@ -0,0 +1,107 @@ +import typing +import pyinfra + +def upgrade( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + update=False, + upgrade=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/postgresql.pyi b/pyinfra/operations/postgresql.pyi new file mode 100644 index 000000000..e3790ce78 --- /dev/null +++ b/pyinfra/operations/postgresql.pyi @@ -0,0 +1,218 @@ +import typing +import pyinfra + +def sql( + sql, + database=None, + # Details for speaking to PostgreSQL via `psql` CLI + psql_user=None, + psql_password=None, + psql_host=None, + psql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def role( + role, + present=True, + password=None, + login=True, + superuser=False, + inherit=False, + createdb=False, + createrole=False, + replication=False, + connection_limit=None, + # Details for speaking to PostgreSQL via `psql` CLI + psql_user=None, + psql_password=None, + psql_host=None, + psql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def database( + database, + present=True, + owner=None, + template=None, + encoding=None, + lc_collate=None, + lc_ctype=None, + tablespace=None, + connection_limit=None, + # Details for speaking to PostgreSQL via `psql` CLI + psql_user=None, + psql_password=None, + psql_host=None, + psql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def dump( + dest, + database=None, + # Details for speaking to PostgreSQL via `psql` CLI + psql_user=None, + psql_password=None, + psql_host=None, + psql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def load( + src, + database=None, + # Details for speaking to PostgreSQL via `psql` CLI + psql_user=None, + psql_password=None, + psql_host=None, + psql_port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/puppet.pyi b/pyinfra/operations/puppet.pyi new file mode 100644 index 000000000..cf88acf13 --- /dev/null +++ b/pyinfra/operations/puppet.pyi @@ -0,0 +1,38 @@ +import typing +import pyinfra + +def agent( + server=None, + port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/python.pyi b/pyinfra/operations/python.pyi new file mode 100644 index 000000000..060dab109 --- /dev/null +++ b/pyinfra/operations/python.pyi @@ -0,0 +1,75 @@ +import typing +import pyinfra + +def call( + function, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, + *args, + **kwargs +): ... +def raise_exception( + exception, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, + *args, + **kwargs +): ... diff --git a/pyinfra/operations/server.pyi b/pyinfra/operations/server.pyi new file mode 100644 index 000000000..3c486adbe --- /dev/null +++ b/pyinfra/operations/server.pyi @@ -0,0 +1,524 @@ +import typing +import pyinfra + +def reboot( + delay=10, + interval=1, + reboot_timeout=300, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def wait( + port=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def shell( + commands, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def script( + src, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def script_template( + src, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, + **data +): ... +def modprobe( + module, + present=True, + force=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def mount( + path, + mounted=True, + options=None, + # TODO: do we want to manage fstab here? + # update_fstab=False, device=None, fs_type=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def hostname( + hostname, + hostname_file=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def sysctl( + key, + value, + persist=False, + persist_file="/etc/sysctl.conf", + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def service( + service, + running=True, + restarted=False, + reloaded=False, + command=None, + enabled=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def crontab( + command, + present=True, + user=None, + cron_name=None, + minute="*", + hour="*", + month="*", + day_of_week="*", + day_of_month="*", + special_time=None, + interpolate_variables=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def group( + group, + present=True, + system=False, + gid=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def user( + user, + present=True, + home=None, + shell=None, + group=None, + groups=None, + public_keys=None, + delete_keys=False, + ensure_home=True, + system=False, + uid=None, + comment=None, + add_deploy_dir=True, + unique=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/ssh.pyi b/pyinfra/operations/ssh.pyi new file mode 100644 index 000000000..2d5808553 --- /dev/null +++ b/pyinfra/operations/ssh.pyi @@ -0,0 +1,156 @@ +import typing +import pyinfra + +def keyscan( + hostname, + force=False, + port=22, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def command( + hostname, + command, + user=None, + port=22, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def upload( + hostname, + filename, + remote_filename=None, + port=22, + user=None, + use_remote_sudo=False, + ssh_keyscan=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def download( + hostname, + filename, + local_filename=None, + force=False, + port=22, + user=None, + ssh_keyscan=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/systemd.pyi b/pyinfra/operations/systemd.pyi new file mode 100644 index 000000000..7e65a998d --- /dev/null +++ b/pyinfra/operations/systemd.pyi @@ -0,0 +1,82 @@ +import typing +import pyinfra + +def daemon_reload( + user_mode=False, + machine=None, + user_name=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def service( + service, + running=True, + restarted=False, + reloaded=False, + command=None, + enabled=None, + daemon_reload=False, + user_mode=False, + machine=None, + user_name=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/sysvinit.pyi b/pyinfra/operations/sysvinit.pyi new file mode 100644 index 000000000..a0fcda07f --- /dev/null +++ b/pyinfra/operations/sysvinit.pyi @@ -0,0 +1,80 @@ +import typing +import pyinfra + +def service( + service, + running=True, + restarted=False, + reloaded=False, + enabled=None, + command=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def enable( + service, + start_priority=20, + stop_priority=80, + start_levels=(2, 3, 4, 5), + stop_levels=(0, 1, 6), + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/upstart.pyi b/pyinfra/operations/upstart.pyi new file mode 100644 index 000000000..8819e8f2c --- /dev/null +++ b/pyinfra/operations/upstart.pyi @@ -0,0 +1,42 @@ +import typing +import pyinfra + +def service( + service, + running=True, + restarted=False, + reloaded=False, + command=None, + enabled=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/vzctl.pyi b/pyinfra/operations/vzctl.pyi new file mode 100644 index 000000000..7aa8ed4a2 --- /dev/null +++ b/pyinfra/operations/vzctl.pyi @@ -0,0 +1,280 @@ +import typing +import pyinfra + +def start( + ctid, + force=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def stop( + ctid, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def restart( + ctid, + force=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def mount( + ctid, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def unmount( + ctid, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def delete( + ctid, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def create( + ctid, + template=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def set( + ctid, + save=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, + **settings +): ... diff --git a/pyinfra/operations/windows.pyi b/pyinfra/operations/windows.pyi new file mode 100644 index 000000000..eeda3bc18 --- /dev/null +++ b/pyinfra/operations/windows.pyi @@ -0,0 +1,73 @@ +import typing +import pyinfra + +def service( + service, + running=True, + restart=False, + suspend=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def reboot( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/windows_files.pyi b/pyinfra/operations/windows_files.pyi new file mode 100644 index 000000000..20bfb6c20 --- /dev/null +++ b/pyinfra/operations/windows_files.pyi @@ -0,0 +1,211 @@ +import typing +import pyinfra + +def download( + src, + dest, + user=None, + group=None, + mode=None, + cache_time=None, + force=False, + sha256sum=None, + sha1sum=None, + md5sum=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def put( + src, + dest, + user=None, + group=None, + mode=None, + add_deploy_dir=True, + create_remote_dir=True, + force=False, + assume_exists=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def file( + path, + present=True, + assume_present=False, + user=None, + group=None, + mode=None, + touch=False, + create_remote_dir=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def directory( + path, + present=True, + assume_present=False, + user=None, + group=None, + mode=None, + recursive=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def link( + path, + target=None, + present=True, + assume_present=False, + user=None, + group=None, + symbolic=True, + force=True, + create_remote_dir=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/xbps.pyi b/pyinfra/operations/xbps.pyi new file mode 100644 index 000000000..5561d9b50 --- /dev/null +++ b/pyinfra/operations/xbps.pyi @@ -0,0 +1,106 @@ +import typing +import pyinfra + +def upgrade( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + update=False, + upgrade=False, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/yum.pyi b/pyinfra/operations/yum.pyi new file mode 100644 index 000000000..3ed4ed108 --- /dev/null +++ b/pyinfra/operations/yum.pyi @@ -0,0 +1,186 @@ +import typing +import pyinfra + +def key( + src, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def repo( + src, + present=True, + baseurl=None, + description=None, + enabled=True, + gpgcheck=True, + gpgkey=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def rpm( + src, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + update=False, + clean=False, + nobest=False, + extra_install_args=None, + extra_uninstall_args=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/pyinfra/operations/zypper.pyi b/pyinfra/operations/zypper.pyi new file mode 100644 index 000000000..3b387092d --- /dev/null +++ b/pyinfra/operations/zypper.pyi @@ -0,0 +1,154 @@ +import typing +import pyinfra + +def repo( + src, + baseurl=None, + present=True, + description=None, + enabled=True, + gpgcheck=True, + gpgkey=None, + type="rpm-md", + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def rpm( + src, + present=True, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def update( + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... +def packages( + packages=None, + present=True, + latest=False, + update=False, + clean=False, + extra_global_install_args=None, + extra_install_args=None, + extra_global_uninstall_args=None, + extra_uninstall_args=None, + _sudo: typing.Optional[bool] = None, + _sudo_user: typing.Optional[bool] = None, + _use_sudo_login: typing.Optional[bool] = None, + _use_sudo_password: typing.Optional[bool] = None, + _preserve_sudo_env: typing.Optional[bool] = None, + _su_user: typing.Optional[str] = None, + _use_su_login: typing.Optional[bool] = None, + _preserve_su_env: typing.Optional[bool] = None, + _su_shell: typing.Optional[str] = None, + _doas: typing.Optional[bool] = None, + _doas_user: typing.Optional[str] = None, + _shell_executable: typing.Optional[str] = None, + _chdir: typing.Optional[str] = None, + _env: typing.Optional[typing.Mapping[str, str]] = None, + _success_exit_codes: typing.Optional[typing.Iterable[int]] = None, + _timeout: typing.Optional[int] = None, + _get_pty: typing.Optional[bool] = None, + _stdin: typing.Optional[typing.Union[str, list, tuple]] = None, + name: typing.Optional[str] = None, + _ignore_errors: typing.Optional[bool] = None, + _precondition: typing.Optional[str] = None, + _postcondition: typing.Optional[str] = None, + _on_success: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _on_error: typing.Optional[ + typing.Callable[[pyinfra.api.state.State, pyinfra.api.host.Host, str], None] + ] = None, + _parallel: typing.Optional[int] = None, + _run_once: typing.Optional[bool] = None, + _serial: typing.Optional[bool] = None, +): ... diff --git a/scripts/generate_operation_type_stubs.py b/scripts/generate_operation_type_stubs.py new file mode 100755 index 000000000..3826829e6 --- /dev/null +++ b/scripts/generate_operation_type_stubs.py @@ -0,0 +1,130 @@ +""" +Generate type stubs for operations. + +This is neccesary because ParamSpec and Concatenate does not support keyword args yet. +See https://github.com/Fizzadar/pyinfra/issues/476 for more info and +especially https://github.com/Fizzadar/pyinfra/issues/476#issuecomment-1100748320. + +See any stub pyinfra/operations/*.pyi to see an example. + +If run from the commandline without arguments it will generate a stub for each +.py file in pyinfra/operations. + +If run from the commandline with 1 or more file paths as arguments +it will generate a stub for each. + +""" + +import os +import sys +from logging import getLogger +from types import LambdaType + +import black +from redbaron import RedBaron + +from pyinfra.api.arguments import OPERATION_KWARGS + +logger = getLogger() + + +def _get_global_arg_names(): + """This extracts the argument names and types from the OPERATION_KWARGS global + variable and generates a list of string on the form "{key}: {type} = None".""" + args = [] + for arg_group in OPERATION_KWARGS.values(): + for arg_name, arg_config in arg_group.items(): + type_ = arg_config["type"] + if isinstance(type_, LambdaType): + type_ = type_() + if type(type_) == type: + # types like int' string representation is so we extract the name + type_ = type_.__name__ + arg = f"{arg_name}: typing.Optional[{type_}] = None\n" + arg = arg.replace("NoneType", "None") + args.append(arg) + return args + + +def create_operation_stub(file_path: str): + """Given filepath, generates a stub file at if any function in that file is decorated with the + @operation decorator. + + The decorator is only identified by name - we do not ensure that it is the specific decorator. + Any decorator called "operation" would trigger a stub generation. + """ + with open(file_path) as f: + content = f.read() + red = RedBaron(content) + operations = red( + "funcdef", # get all function definitions + lambda node: any( + [dec("name", "operation") for dec in node.decorators], + ), # with decorator named "operation" + ) + if operations: + tree = RedBaron("import typing\nimport pyinfra\n") + global_args = _get_global_arg_names() + ellipses = RedBaron("...") + for operation in operations: + stub = operation.copy() + stub.decorators = [] + stub = stub.copy() + stub.value = ellipses + stub.arguments.extend(global_args) + # *args and **kwargs must be moved the end of the argument list + list_argument_index = None + for i, argument in enumerate(stub.arguments): + if argument.type == "list_argument": + list_argument_index = i + if list_argument_index is not None: + list_arg = stub.arguments[list_argument_index] + stub.arguments.pop( + list_argument_index, + ) # pop does not return the element for some reason + stub.arguments.append(list_arg) + + dict_argument_index = None + for i, argument in enumerate(stub.arguments): + if argument.type == "dict_argument": + dict_argument_index = i + if dict_argument_index is not None: + dict_arg = stub.arguments[dict_argument_index] + stub.arguments.pop(dict_argument_index) + stub.arguments.append(dict_arg) + tree.extend(RedBaron("\n\n")) + tree.extend(stub) + + output_file_path = file_path + "i" + + pyi_content = tree.dumps() + "\n\n" + # If using @operation(...) as opposed to @operation, it will generate a single long + # for each function. Formatting with black solves this. + pyi_content_formatted = black.format_str(pyi_content, mode=black.FileMode(is_pyi=True)) + + with open(output_file_path, "w") as f: + f.write(pyi_content_formatted) + print(f"--> Generated: {output_file_path}") + + else: + logger.info(f"No operations found in file {file_path}") + + +def create_all_operation_stubs(): + """Created stub for all files in pyinfra/operations (not recursively). + Assume to be run from project root""" + operation_dir = os.path.join("pyinfra", "operations") + for operation_file in os.listdir(operation_dir): + full_path = os.path.join(operation_dir, operation_file) + if os.path.isfile(full_path) and os.path.splitext(full_path)[1] == ".py": + logger.info(f"generate for file {full_path}") + create_operation_stub(full_path) + + +if __name__ == "__main__": + if len(sys.argv) > 1: + for path in sys.argv[1:]: + logger.info(f"generate for file {path}") + create_operation_stub(path) + else: + create_all_operation_stubs() diff --git a/setup.py b/setup.py index 00ba3a9d6..fc5b97714 100644 --- a/setup.py +++ b/setup.py @@ -69,6 +69,7 @@ "ipdbplugin", # Lint spellchecking, dev only (don't fail CI) "flake8-spellcheck==0.12.1", + "redbaron", # for generating type stubs ) ) diff --git a/tests/words.txt b/tests/words.txt index 5fff662d0..e50c45172 100644 --- a/tests/words.txt +++ b/tests/words.txt @@ -16,6 +16,7 @@ FakePathLike Launchd Openvz +UNIXCONFDIR acl addrs addsitedir @@ -28,14 +29,12 @@ apk arg1 arg2 argbits -endian argspec argstring askpass asn autodetect autogenerate -utf16 automagically automount autoname @@ -73,7 +72,6 @@ createrole credssp cron crons -UNIXCONFDIR crontab ctid ctrl @@ -106,6 +104,7 @@ e305 e402 e501 ed25519 +endian entrypoint epel excuted @@ -261,6 +260,7 @@ pxelinux py pyc pygments +pyi pyinfra pyinfrawinrmsession pywinrm @@ -269,6 +269,7 @@ rcd readlink rebase recv +redbaron release remote remoteforward @@ -353,6 +354,7 @@ unitialised unmount up up2 +utf16 v v0 v1