Skip to content

Commit 5589aa5

Browse files
author
Tobias Fuhrimann
committed
Fix runtime bugs
1 parent b7032b4 commit 5589aa5

4 files changed

Lines changed: 31 additions & 13 deletions

File tree

main.go

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (p *AppCloudPlugin) GetMetadata() plugin.PluginMetadata {
121121
Name: "resend-billing-account-invitation",
122122
HelpText: "Resend an existing billing account invitation",
123123
UsageDetails: plugin.Usage{
124-
Usage: "resend-org-invitation USERNAME BILLING_ACCOUNT",
124+
Usage: "resend-billing-account-invitation USERNAME BILLING_ACCOUNT",
125125
},
126126
},
127127
{
@@ -135,7 +135,7 @@ func (p *AppCloudPlugin) GetMetadata() plugin.PluginMetadata {
135135
Name: "resend-space-invitation",
136136
HelpText: "Resend an existing space invitation",
137137
UsageDetails: plugin.Usage{
138-
Usage: "resend-org-invitation USERNAME SPACE",
138+
Usage: "resend-space-invitation USERNAME SPACE",
139139
},
140140
},
141141

@@ -342,25 +342,27 @@ func (p *AppCloudPlugin) Run(cliConnection plugin.CliConnection, args []string)
342342
case "ssl-certificates":
343343
err = p.SSLCertificates(cliConnection)
344344
case "create-ssl-certificate":
345-
if len(args) < 2 {
345+
if len(args) < 2 || len(args) > 4 {
346346
fmt.Println("Incorrect Usage: the required argument DOMAIN was not provided")
347347
return
348348
}
349349

350-
fc, err := parseSSLCertificateArgs(args)
350+
var fc flags.FlagContext
351+
fc, err = parseSSLCertificateArgs(args)
351352
if err != nil {
352353
fmt.Println("Incorrect Usage: Organization option must be a string")
353354
return
354355
}
355356

356-
err = p.CreateSSLCertificate(cliConnection, args[2], fc.String("n"))
357+
err = p.CreateSSLCertificate(cliConnection, args[1], fc.String("n"))
357358
case "revoke-ssl-certificate":
358359
if len(args) < 2 {
359360
fmt.Println("Incorrect Usage: the required argument DOMAIN was not provided")
360361
return
361362
}
362363

363-
fc, err := parseSSLCertificateArgs(args)
364+
var fc flags.FlagContext
365+
fc, err = parseSSLCertificateArgs(args)
364366
if err != nil {
365367
fmt.Println("Incorrect Usage: HOSTNAME must be a string")
366368
return
@@ -373,7 +375,8 @@ func (p *AppCloudPlugin) Run(cliConnection plugin.CliConnection, args []string)
373375
return
374376
}
375377

376-
fc, err := parseSSLCertificateArgs(args)
378+
var fc flags.FlagContext
379+
fc, err = parseSSLCertificateArgs(args)
377380
if err != nil {
378381
fmt.Println("Incorrect Usage: HOSTNAME must be a string")
379382
return
@@ -386,7 +389,8 @@ func (p *AppCloudPlugin) Run(cliConnection plugin.CliConnection, args []string)
386389
return
387390
}
388391

389-
fc, err := parseSSLCertificateArgs(args)
392+
var fc flags.FlagContext
393+
fc, err = parseSSLCertificateArgs(args)
390394
if err != nil {
391395
fmt.Println("Incorrect Usage: HOSTNAME must be a string")
392396
return
@@ -399,7 +403,8 @@ func (p *AppCloudPlugin) Run(cliConnection plugin.CliConnection, args []string)
399403
return
400404
}
401405

402-
fc, err := parseSSLCertificateArgs(args)
406+
var fc flags.FlagContext
407+
fc, err = parseSSLCertificateArgs(args)
403408
if err != nil {
404409
fmt.Println("Incorrect Usage: HOSTNAME must be a string")
405410
return
@@ -409,7 +414,8 @@ func (p *AppCloudPlugin) Run(cliConnection plugin.CliConnection, args []string)
409414

410415
// Tree
411416
case "tree":
412-
fc, err := parseTreeArgs(args)
417+
var fc flags.FlagContext
418+
fc, err = parseTreeArgs(args)
413419
if err != nil {
414420
fmt.Println("Incorrect Usage: DEPTH must be an integer")
415421
return

resend_billing_account_invitation.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// ResendBillingAccountInvitation resends an existing billing account invitation.
13-
func (p *AppCloudPlugin) ResendBillingAccountInvitation(c plugin.CliConnection, billingAccountName string, invitee string) error {
13+
func (p *AppCloudPlugin) ResendBillingAccountInvitation(c plugin.CliConnection, invitee string, billingAccountName string) error {
1414
username, err := c.Username()
1515
if err != nil {
1616
username = "you"
@@ -51,6 +51,10 @@ func (p *AppCloudPlugin) ResendBillingAccountInvitation(c plugin.CliConnection,
5151
if err != nil {
5252
return errors.New("Couldn't read JSON response from server")
5353
}
54+
55+
if invRes.ErrorCode != "" {
56+
return errors.New(invRes.Description)
57+
}
5458
}
5559
}
5660

resend_org_invitation.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// ResendOrgInvitation resends an existing org invitation.
13-
func (p *AppCloudPlugin) ResendOrgInvitation(c plugin.CliConnection, orgName string, invitee string) error {
13+
func (p *AppCloudPlugin) ResendOrgInvitation(c plugin.CliConnection, invitee string, orgName string) error {
1414
username, err := c.Username()
1515
if err != nil {
1616
username = "you"
@@ -51,6 +51,10 @@ func (p *AppCloudPlugin) ResendOrgInvitation(c plugin.CliConnection, orgName str
5151
if err != nil {
5252
return errors.New("Couldn't read JSON response from server")
5353
}
54+
55+
if invRes.ErrorCode != "" {
56+
return errors.New(invRes.Description)
57+
}
5458
}
5559
}
5660

resend_space_invitation.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
// ResendSpaceInvitation resends an existing space invitation.
13-
func (p *AppCloudPlugin) ResendSpaceInvitation(c plugin.CliConnection, spaceName string, invitee string) error {
13+
func (p *AppCloudPlugin) ResendSpaceInvitation(c plugin.CliConnection, invitee string, spaceName string) error {
1414
username, err := c.Username()
1515
if err != nil {
1616
username = "you"
@@ -51,6 +51,10 @@ func (p *AppCloudPlugin) ResendSpaceInvitation(c plugin.CliConnection, spaceName
5151
if err != nil {
5252
return errors.New("Couldn't read JSON response from server")
5353
}
54+
55+
if invRes.ErrorCode != "" {
56+
return errors.New(invRes.Description)
57+
}
5458
}
5559
}
5660

0 commit comments

Comments
 (0)