0
0
forked from toolshed/abra

fix: server/record improved output + interactivity

This commit is contained in:
2021-10-25 09:02:24 +02:00
parent 2d091a6b00
commit a7970132c2
7 changed files with 68 additions and 39 deletions

View File

@ -391,7 +391,7 @@ You may omit flags to avoid performing this provisioning logic.
internal.ShowSubcommandHelpAndError(c, err)
}
if sshAuth != "password" || sshAuth != "identity-file" {
if sshAuth != "password" && sshAuth != "identity-file" {
err := errors.New("--ssh-auth only accepts 'identity-file' or 'password'")
internal.ShowSubcommandHelpAndError(c, err)
}
@ -403,7 +403,10 @@ You may omit flags to avoid performing this provisioning logic.
return nil
}
domainName := internal.ValidateDomain(c)
domainName, err := internal.ValidateDomain(c)
if err != nil {
logrus.Fatal(err)
}
if err := createServerDir(domainName); err != nil {
logrus.Fatal(err)

View File

@ -68,23 +68,31 @@ func newHetznerCloudVPS(c *cli.Context) error {
return err
}
tableColumns = []string{"name", "ipv4", "root password"}
table = formatter.CreateTable(tableColumns)
var rootPassword string
if len(sshKeys) > 0 {
table.Append([]string{
internal.HetznerCloudName,
res.Server.PublicNet.IPv4.IP.String(),
"N/A (using SSH keys)",
})
rootPassword = "N/A (using SSH keys)"
} else {
table.Append([]string{
internal.HetznerCloudName,
res.Server.PublicNet.IPv4.IP.String(),
res.RootPassword,
})
rootPassword = res.RootPassword
}
table.SetCaption(true, "hetzner cloud creation response")
table.Render()
ip := res.Server.PublicNet.IPv4.IP.String()
fmt.Println(fmt.Sprintf(`
Your new Hetzner Cloud VPS has successfully been created! Here are the details:
VPS Name: %s
VPS IP address: %s
VPS Root Password: %s
You can access this new VPS via SSH using the following command:
ssh root@%s
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
not list this server)! You will need to assign a domain name record ("abra
record new") and add the server to your Abra configuration ("abra server add")
to have a working server that you can deploy Co-op Cloud apps to.
`, internal.HetznerCloudName, ip, rootPassword, ip))
return nil
}
@ -136,11 +144,22 @@ func newCapsulVPS(c *cli.Context) error {
return err
}
tableColumns = []string{"Name", "ID"}
table = formatter.CreateTable(tableColumns)
table.Append([]string{internal.CapsulName, resp.ID})
table.SetCaption(true, "capsul creation response")
table.Render()
fmt.Println(fmt.Sprintf(`
Your new Capsul has successfully been created! Here are the details:
Capsul name: %s
Capsul ID: %v
You will need to log into your Capsul instance web interface to retrieve the IP
address. You can learn all about how to get SSH access to your new Capsul on:
%s/about-ssh
Please note, this server is not managed by Abra yet (i.e. "abra server ls" will
not list this server)! You will need to assign a domain name record ("abra
record new") and add the server to your Abra configuration ("abra server add")
to have a working server that you can deploy Co-op Cloud apps to.
`, internal.CapsulName, resp.ID, internal.CapsulInstanceURL))
return nil
}

View File

@ -45,7 +45,10 @@ like tears in rain.
internal.DNSProviderFlag,
},
Action: func(c *cli.Context) error {
domainName := internal.ValidateDomain(c)
domainName, err := internal.ValidateDomain(c)
if err != nil {
logrus.Fatal(err)
}
if rmServer {
if err := internal.EnsureServerProvider(); err != nil {