def __init__(self, host, ssh_config, ssh_key_filepath): ssh_config = SSHConfig.from_path(ssh_config) ssh_tgt = ssh_config.lookup(host) self.host = ssh_tgt.get("hostname") self.user = ssh_tgt.get("user") self.ssh_key_filepath = ssh_key_filepath self.client = None
def test_from_path(self): # NOTE: DO NOT replace with use of load_config() :D config = SSHConfig.from_path(_config("robey")) assert config.lookup("meh.example.com")["port"] == "3333"
def load_config(name): return SSHConfig.from_path(_config(name))