cloud/shepherd: move ssh client to own package
Change-Id: I56ad16f8f2f355243c5c0414656bbfbbff1faef5
Reviewed-on: https://review.monogon.dev/c/monogon/+/2791
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/shepherd/manager/provider_test.go b/cloud/shepherd/manager/provider_test.go
index b18dc45..4cdfb18 100644
--- a/cloud/shepherd/manager/provider_test.go
+++ b/cloud/shepherd/manager/provider_test.go
@@ -12,6 +12,7 @@
"source.monogon.dev/cloud/bmaas/bmdb"
"source.monogon.dev/cloud/bmaas/bmdb/model"
"source.monogon.dev/cloud/shepherd"
+ "source.monogon.dev/go/net/ssh"
)
type dummyMachine struct {
@@ -38,17 +39,17 @@
}
type dummySSHClient struct {
- SSHClient
+ ssh.Client
dp *dummyProvider
}
type dummySSHConnection struct {
- SSHConnection
+ ssh.Connection
m *dummyMachine
}
func (dsc *dummySSHConnection) Execute(ctx context.Context, command string, stdin []byte) ([]byte, []byte, error) {
- stdout, stderr, err := dsc.SSHConnection.Execute(ctx, command, stdin)
+ stdout, stderr, err := dsc.Connection.Execute(ctx, command, stdin)
if err != nil {
return nil, nil, err
}
@@ -57,8 +58,8 @@
return stdout, stderr, nil
}
-func (dsc *dummySSHClient) Dial(ctx context.Context, address string, timeout time.Duration) (SSHConnection, error) {
- conn, err := dsc.SSHClient.Dial(ctx, address, timeout)
+func (dsc *dummySSHClient) Dial(ctx context.Context, address string, timeout time.Duration) (ssh.Connection, error) {
+ conn, err := dsc.Client.Dial(ctx, address, timeout)
if err != nil {
return nil, err
}
@@ -77,10 +78,10 @@
return &dummySSHConnection{conn, m}, nil
}
-func (dp *dummyProvider) sshClient() SSHClient {
+func (dp *dummyProvider) sshClient() ssh.Client {
return &dummySSHClient{
- SSHClient: &FakeSSHClient{},
- dp: dp,
+ Client: &FakeSSHClient{},
+ dp: dp,
}
}