From 31661017765371d5426f4d7244d33d994afb7365 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 7 Feb 2023 13:38:22 +0100 Subject: SshTransport --- automato/transport.py | 5 +++-- endpoints.yml | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/automato/transport.py b/automato/transport.py index ffee1d6..64c3db6 100644 --- a/automato/transport.py +++ b/automato/transport.py @@ -57,13 +57,14 @@ class Transport: class SshTransport(Transport): CONNECTION=HOLD - def __init__(self, hostname: str, port=22, username='root', password = None, id_file = None): + def __init__(self, hostname: str, port=22, username='root', password = None, id_file = None, allow_agent=False): super().__init__() self._hostname = hostname self._port = port self._username = username self._password = password self._id_file = id_file + self._allow_agent = allow_agent self._client = None @@ -72,7 +73,7 @@ class SshTransport(Transport): # TODO known hosts self._client.set_missing_host_key_policy(paramiko.client.AutoAddPolicy) - self._client.connect(self._hostname, port=self._port, username=self._username, password=self._password, key_filename=None, allow_agent=True) + self._client.connect(self._hostname, port=self._port, username=self._username, password=self._password, key_filename=self._id_file, allow_agent=self._allow_agent) self._connected = True diff --git a/endpoints.yml b/endpoints.yml index c4d35bc..26d5340 100644 --- a/endpoints.yml +++ b/endpoints.yml @@ -4,6 +4,7 @@ host1: class: automato.transport.SshTransport hostname: 'localhost' username: 'jonas' + allow_agent: True commands: notify: class: automato.command.NotifyCommand -- cgit v1.2.3