pyinfra.api.connectors.local module

pyinfra.api.connectors.local.check_can_rsync()
pyinfra.api.connectors.local.connect(state, host)
pyinfra.api.connectors.local.get_file(state, host, remote_filename, filename_or_io, print_output=False, print_input=False, **command_kwargs)

Download a local file by copying it to a temporary location and then writing it to our filename or IO object.

pyinfra.api.connectors.local.make_names_data(hostname=None)
pyinfra.api.connectors.local.put_file(state, host, filename_or_io, remote_filename, print_output=False, print_input=False, **command_kwargs)

Upload a local file or IO object by copying it to a temporary directory and then writing it to the upload location.

pyinfra.api.connectors.local.rsync(state, host, src, dest, flags, print_output=False, print_input=False, **command_kwargs)
pyinfra.api.connectors.local.run_shell_command(state, host, command, get_pty=False, timeout=None, stdin=None, success_exit_codes=None, print_output=False, print_input=False, return_combined_output=False, use_sudo_password=False, **command_kwargs)

Execute a command on the local machine.

Parameters
  • state (pyinfra.api.State object) – state object for this command
  • host (pyinfra.api.Host object) – the target host
  • command (string) – actual command to execute
  • sudo (boolean) – whether to wrap the command with sudo
  • sudo_user (string) – user to sudo to
  • env (dict) – environment variables to set
  • timeout (int) – timeout for this command to complete before erroring
Returns

(exit_code, stdout, stderr) stdout and stderr are both lists of strings from each buffer.

Return type

tuple