From ecf7c86bc2f64068e6256ac1b9738c712a9858e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20B=C3=BCtow?= Date: Tue, 11 Feb 2020 13:10:26 +0000 Subject: more on scheduled jobs and ssh callbacks --- internal/clients/baseclient.go | 6 +++--- internal/clients/remote/connection.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'internal/clients') diff --git a/internal/clients/baseclient.go b/internal/clients/baseclient.go index 725910a..75da187 100644 --- a/internal/clients/baseclient.go +++ b/internal/clients/baseclient.go @@ -27,7 +27,7 @@ type baseClient struct { // SSH auth methods to use to connect to the remote servers. sshAuthMethods []gossh.AuthMethod // To deal with SSH host keys - hostKeyCallback *client.HostKeyCallback + hostKeyCallback client.HostKeyCallback // Throttle how fast we initiate SSH connections concurrently throttleCh chan struct{} // Retry connection upon failure? @@ -40,7 +40,7 @@ func (c *baseClient) init(maker maker) { logger.Info("Initiating base client") c.maker = maker - c.sshAuthMethods, c.hostKeyCallback = client.InitSSHAuthMethods(c.Args, c.throttleCh) + c.sshAuthMethods, c.hostKeyCallback = client.InitSSHAuthMethods(c.Args.SSHAuthMethods, c.Args.SSHHostKeyCallback, c.Args.TrustAllHosts, c.throttleCh) discoveryService := discovery.New(c.Discovery, c.ServersStr, discovery.Shuffle) @@ -107,7 +107,7 @@ func (c *baseClient) start(ctx context.Context, active chan struct{}, i int, con } } -func (c *baseClient) makeConnection(server string, sshAuthMethods []gossh.AuthMethod, hostKeyCallback *client.HostKeyCallback) *remote.Connection { +func (c *baseClient) makeConnection(server string, sshAuthMethods []gossh.AuthMethod, hostKeyCallback client.HostKeyCallback) *remote.Connection { conn := remote.NewConnection(server, c.UserName, sshAuthMethods, hostKeyCallback) conn.Handler = c.maker.makeHandler(server) conn.Commands = c.maker.makeCommands() diff --git a/internal/clients/remote/connection.go b/internal/clients/remote/connection.go index 71639b1..f95c6a6 100644 --- a/internal/clients/remote/connection.go +++ b/internal/clients/remote/connection.go @@ -33,11 +33,11 @@ type Connection struct { // Is it a persistent connection or a one-off? isOneOff bool // To deal with SSH server host keys - hostKeyCallback *client.HostKeyCallback + hostKeyCallback client.HostKeyCallback } // NewConnection returns a new connection. -func NewConnection(server string, userName string, authMethods []ssh.AuthMethod, hostKeyCallback *client.HostKeyCallback) *Connection { +func NewConnection(server string, userName string, authMethods []ssh.AuthMethod, hostKeyCallback client.HostKeyCallback) *Connection { logger.Debug(server, "Creating new connection") c := Connection{ -- cgit v1.2.3