fix: handle missing ssh keys (pass auth)

This commit is contained in:
decentral1se 2022-01-02 01:52:33 +01:00
parent 13661c72ce
commit 2c78ac22e0
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 6 additions and 4 deletions

View File

@ -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?"))
}

View File

@ -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()