Skip to content

Commit

Permalink
Merge pull request #6111 from planetscale/ss-vtctld-nocell
Browse files Browse the repository at this point in the history
vtctld: make cell optional
  • Loading branch information
morgo authored Apr 27, 2020
2 parents 66386cc + 14a4fa4 commit bec4139
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions go/vt/vtctld/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,17 @@ func initAPI(ctx context.Context, ts *topo.Server, actions *ActionRepository, re

if cell == "local" {
if *localCell == "" {
return nil, fmt.Errorf("local cell requested, but not specified. Please set with -cell flag")
cells, err := ts.GetCellInfoNames(ctx)
if err != nil {
return nil, fmt.Errorf("could not fetch cell info: %v", err)
}
if len(cells) == 0 {
return nil, fmt.Errorf("no local cells have been created yet")
}
cell = cells[0]
} else {
cell = *localCell
}
cell = *localCell
}

// If a keyspace is provided then return the specified srvkeyspace.
Expand Down

0 comments on commit bec4139

Please sign in to comment.