Skip to content

Commit

Permalink
merge(#358): handle double create 201 response
Browse files Browse the repository at this point in the history
Handle double create 201 response
  • Loading branch information
akijakya authored Nov 24, 2021
2 parents afb54dc + 84ef7a4 commit b30a3fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/cli/command/cluster/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,17 @@ func runCreate(banzaiCli cli.Cli, options createOptions) error {
}

log.Debugf("create request: %#v", out)
cluster, _, err := banzaiCli.Client().ClustersApi.CreateCluster(context.Background(), orgID, out)
cluster, resp, err := banzaiCli.Client().ClustersApi.CreateCluster(context.Background(), orgID, out)
if err != nil {
cli.LogAPIError("create cluster", err, out)
return errors.WrapIf(err, "failed to create cluster")
}

if resp.StatusCode == http.StatusCreated {
log.Infof(`cluster "%s" is already being created`, out["name"])
return nil
}

log.Info("cluster is being created")
if options.wait {
for {
Expand Down

0 comments on commit b30a3fc

Please sign in to comment.