From 2c78ac22e091446fdbe1638ebafb64cfae0dc7ef Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Sun, 2 Jan 2022 01:52:33 +0100 Subject: [PATCH] fix: handle missing ssh keys (pass auth) --- cli/internal/validate.go | 3 --- cli/server/new.go | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/internal/validate.go b/cli/internal/validate.go index 1902a8a9..81d43267 100644 --- a/cli/internal/validate.go +++ b/cli/internal/validate.go @@ -484,9 +484,6 @@ func EnsureNewHetznerCloudVPSFlags(c *cli.Context) error { if HetznerCloudImage == "" { ShowSubcommandHelpAndError(c, fmt.Errorf("missing hetzner cloud image?")) } - if len(HetznerCloudSSHKeys.Value()) == 0 { - ShowSubcommandHelpAndError(c, fmt.Errorf("missing hetzner cloud ssh keys?")) - } if HetznerCloudLocation == "" { ShowSubcommandHelpAndError(c, fmt.Errorf("missing hetzner cloud VPS location?")) } diff --git a/cli/server/new.go b/cli/server/new.go index e05b1880..f2e5eef2 100644 --- a/cli/server/new.go +++ b/cli/server/new.go @@ -43,13 +43,18 @@ func newHetznerCloudVPS(c *cli.Context) error { Location: &hcloud.Location{Name: internal.HetznerCloudLocation}, } + sshKeyIDs := strings.Join(sshKeysRaw, "\n") + if sshKeyIDs == "" { + sshKeyIDs = "N/A (password auth)" + } + tableColumns := []string{"name", "type", "image", "ssh-keys", "location"} table := formatter.CreateTable(tableColumns) table.Append([]string{ internal.HetznerCloudName, internal.HetznerCloudType, internal.HetznerCloudImage, - strings.Join(sshKeysRaw, "\n"), + sshKeyIDs, internal.HetznerCloudLocation, }) table.Render()