From 84e7605e3621d3d98869725a71ea43e6f3979dff Mon Sep 17 00:00:00 2001 From: Sylvia Crowe Date: Wed, 7 Feb 2024 17:01:35 -0800 Subject: [PATCH] refactor: change argument order in GetUserInput This is a simple change to move the context to the first argument of GetUserInput to match the convention used elsewhere in the code. --- wavesrv/pkg/remote/sshclient.go | 8 ++++---- wavesrv/pkg/sstore/updatebus.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wavesrv/pkg/remote/sshclient.go b/wavesrv/pkg/remote/sshclient.go index 0ce109804..5ea391b44 100644 --- a/wavesrv/pkg/remote/sshclient.go +++ b/wavesrv/pkg/remote/sshclient.go @@ -73,7 +73,7 @@ func createInteractivePasswordCallbackPrompt() func() (secret string, err error) QueryText: "Password:", Title: "Password Authentication", } - response, err := sstore.MainBus.GetUserInput(request, ctx) + response, err := sstore.MainBus.GetUserInput(ctx, request) if err != nil { return "", err } @@ -133,7 +133,7 @@ func promptChallengeQuestion(question string, echo bool) (answer string, err err QueryText: question, Title: "Keyboard Interactive Authentication", } - response, err := sstore.MainBus.GetUserInput(request, ctx) + response, err := sstore.MainBus.GetUserInput(ctx, request) if err != nil { return "", err } @@ -216,7 +216,7 @@ func createUnknownKeyVerifier(knownHostsFile string, hostname string, remote str return func() (*scpacket.UserInputResponsePacketType, error) { ctx, cancelFn := context.WithTimeout(context.Background(), 60*time.Second) defer cancelFn() - return sstore.MainBus.GetUserInput(request, ctx) + return sstore.MainBus.GetUserInput(ctx, request) } } @@ -240,7 +240,7 @@ func createMissingKnownHostsVerifier(knownHostsFile string, hostname string, rem return func() (*scpacket.UserInputResponsePacketType, error) { ctx, cancelFn := context.WithTimeout(context.Background(), 60*time.Second) defer cancelFn() - return sstore.MainBus.GetUserInput(request, ctx) + return sstore.MainBus.GetUserInput(ctx, request) } } diff --git a/wavesrv/pkg/sstore/updatebus.go b/wavesrv/pkg/sstore/updatebus.go index 4fd950d5c..3bc5c2237 100644 --- a/wavesrv/pkg/sstore/updatebus.go +++ b/wavesrv/pkg/sstore/updatebus.go @@ -316,7 +316,7 @@ func (bus *UpdateBus) GetUserInputChannel(id string) (chan *scpacket.UserInputRe return uich, ok } -func (bus *UpdateBus) GetUserInput(userInputRequest *UserInputRequestType, ctx context.Context) (*scpacket.UserInputResponsePacketType, error) { +func (bus *UpdateBus) GetUserInput(ctx context.Context, userInputRequest *UserInputRequestType) (*scpacket.UserInputResponsePacketType, error) { id, uich := bus.registerUserInputChannel() defer bus.unregisterUserInputChannel(id)