From fae2354914641d29e6016dfe91bcf7d964a20ccd Mon Sep 17 00:00:00 2001 From: pauhull <22707808+pauhull@users.noreply.github.com> Date: Thu, 11 Jan 2024 16:25:38 +0100 Subject: [PATCH] add info message when using context keys --- internal/cmd/server/create.go | 3 ++- internal/cmd/server/enable_rescue.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/cmd/server/create.go b/internal/cmd/server/create.go index 038b6268..7fafe1a0 100644 --- a/internal/cmd/server/create.go +++ b/internal/cmd/server/create.go @@ -263,7 +263,8 @@ func createOptsFromFlags( // check if ssh-key flag was set, otherwise set to defaults if !flags.Changed("ssh-key") { - if ctx := s.Config().ActiveContext(); ctx != nil { + if ctx := s.Config().ActiveContext(); ctx != nil && len(ctx.SSHKeys) > 0 { + cmd.Println("Using SSH key(s) from active context") sshKeys = ctx.SSHKeys } } diff --git a/internal/cmd/server/enable_rescue.go b/internal/cmd/server/enable_rescue.go index 9ff91a02..4c74391f 100644 --- a/internal/cmd/server/enable_rescue.go +++ b/internal/cmd/server/enable_rescue.go @@ -49,7 +49,8 @@ var EnableRescueCmd = base.Cmd{ // check if ssh-key flag was set, otherwise set to defaults if !cmd.Flags().Changed("ssh-key") { - if ctx := s.Config().ActiveContext(); ctx != nil { + if ctx := s.Config().ActiveContext(); ctx != nil && len(ctx.SSHKeys) > 0 { + cmd.Println("Using SSH key(s) from active context") sshKeys = ctx.SSHKeys } }