pyinfra.api.connectors.winrm module

pyinfra.api.connectors.winrm.connect(state, host)

Connect to a single host. Returns the winrm Session if successful.

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

Upload file by chunking and sending base64 encoded via winrm

pyinfra.api.connectors.winrm.run_shell_command(state, host, command, env=None, success_exit_codes=None, print_output=False, print_input=False, return_combined_output=False, shell_executable=None, **ignored_command_kwargs)

Execute a command on the specified host.

Parameters
  • state (pyinfra.api.State obj) – state object for this command
  • hostname (string) – hostname of the target
  • command (string) – actual command to execute
  • success_exit_codes (list) – all values in the list that will return success
  • print_output (boolean) – print the output
  • print_intput (boolean) – print the input
  • return_combined_output (boolean) – combine the stdout and stderr lists
  • shell_executable (string) – shell to use - ‘sh’=cmd, ‘ps’=powershell(default)
  • env (dict) – environment variables to set
Returns

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

Return type

tuple

pyinfra.api.connectors.winrm.show_warning()