The argus.client.windows Module

class argus.client.windows.WinRemoteClient(hostname, username, password, transport_protocol='http', cert_pem=None, cert_key=None)

Get a remote client to a Windows instance.

Parameters:
  • hostname – The ip where the client should be connected.
  • username – The username of the client.
  • password – The password of the remote client.
  • transport_protocol – The transport for the WinRM protocol. Only http and https makes sense.
  • cert_pem – Client authentication certificate file path in PEM format.
  • cert_key – Client authentication certificate key file path in PEM format.
copy_file(filepath, remote_destination)

Copy the given filepath in the remote destination.

The remote destination is the file name where the content of filepath will be written.

read_file(filepath)

Get the content of the given file.

run_command(cmd, command_type='powershell')

Run the given command and return execution details.

Return type:tuple
Returns:stdout, stderr, exit_code
run_command_until_condition(cmd, cond, retry_count=15, delay=10, command_type='powershell')

Run the given cmd until a condition cond occurs.

Parameters:cond – A callable which receives the standard output returned by executing the command. It should return a boolean value, which tells to this function to stop execution.
Raises:ArgusCLIError if there is output found in the standard error.

This method uses and behaves like run_command_with_retry but with an additional condition parameter.

run_command_verbose(cmd, command_type='powershell')

Run the given command and log anything it returns.

Do this with retrying support.

Return type:string
Returns:stdout
run_command_with_retry(cmd, count=15, delay=10, command_type='powershell')

Run the given cmd until succeeds.

Parameters:
  • cmd – A string, representing a command which needs to be executed on the underlying remote client.
  • count – The number of retries which this function has. If the value is None, then the function will retry forever.
  • delay – The number of seconds to sleep when retrying a command.
Return type:

tuple

Returns:

stdout, stderr, exit_code

run_remote_cmd(cmd, command_type='powershell')

Run the given remote command.

The command will be executed on the remote underlying server. It will return a tuple of three elements, stdout, stderr and the return code of the command.

write_file(data, remote_destination)

Copy the given data in the remote destination.

The remote destination is the file name where the content of filepath will be written.