SSH and Rsync Support
- class carthage.ssh.RsyncPath(machine: Machine, path: str, runas_user: str = None)
In
rsync(), local paths are represented directly and remote paths are represented as aRsyncPath. RsyncPath has a target machine (aMachine) and path. There is also a runas_user. If not specified runas_user defaults to the runas_user of the machine. It is an error to use two RsyncPaths in the same call to rsync with differing runas_user.- property relpath
Path relative to the root directory of machine
- class carthage.ssh.SshAgent(injector, key)
- class carthage.ssh.SshKey(**kwargs)
- async async_ready()
This may need to be overridden, but is provided as a default
- key_path()
The path of the private key suitable for inclusion with
ssh -ior None if no filesystem key exists.
- stamp_path()
A place to store cached information like completion stamps for setup tasks. Removing config.cache_dir may decrease performance but should not remove hard-to-recover state like keys.
- state_path()
A place to store state that should be preserved like keys, tokens, or assignment databases.
- carthage.ssh.ssh_handle_jump_host(jump_host)
Returns ssh options for connecting to a jump host. If jump_host is None, returns an empty tuple.
If jump_host is a string, returns that string.
If jump_host is a Machine or MachineModel, calculates the appropriate jump host specification assuming that machine is to be used.
- carthage.ssh.ssh_user_addr(machine)
Returns a string like
root@test.example.comfrom a model with ip_address oftest.example.comand ssh_login_user ofroot.- Parameters:
machine – a
Machineor something else with ip_address and ssh_login_user.
This handles things like ssh_login_user being None.
Note that
carthage.machine.Machine.ip_address()can best be thought of as the endpoint to connect to for management of a machine. It is often but not always an ip_address.