From 3955883f6b516d6722dea3ef09a39640f80c64c6 Mon Sep 17 00:00:00 2001 From: Jeroen van Erp Date: Thu, 17 Mar 2022 10:06:22 +0100 Subject: [PATCH] Do not return a '-1' exit if no keys found and json/yaml output --- cmd/kops/get_sshpublickeys.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/kops/get_sshpublickeys.go b/cmd/kops/get_sshpublickeys.go index 949695a43e..c2b169cfeb 100644 --- a/cmd/kops/get_sshpublickeys.go +++ b/cmd/kops/get_sshpublickeys.go @@ -105,12 +105,12 @@ func RunGetSSHPublicKeys(ctx context.Context, f *util.Factory, out io.Writer, op items = append(items, item) } - if len(items) == 0 { - return fmt.Errorf("no SSH public key found") - } switch options.Output { case OutputTable: + if len(items) == 0 { + return fmt.Errorf("no SSH public key found") + } t := &tables.Table{} t.AddColumn("ID", func(i *SSHKeyItem) string { return i.ID