Skip to content

Commit

Permalink
topo: consul paths don't start with '/'
Browse files Browse the repository at this point in the history
So, we should only check for non-empty topo roots instead of
a '/' prefix.

Signed-off-by: Sugu Sougoumarane <[email protected]>
  • Loading branch information
sougou committed Apr 27, 2020
1 parent 200b261 commit a129d14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions go/vt/topo/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ package topo
import (
"flag"
"fmt"
"strings"
"sync"

"golang.org/x/net/context"
Expand Down Expand Up @@ -219,8 +218,8 @@ func Open() *Server {
if *topoGlobalServerAddress == "" && *topoImplementation != "k8s" {
log.Exitf("topo_global_server_address must be configured")
}
if !strings.HasPrefix(*topoGlobalRoot, "/") {
log.Exitf("topo_global_root must be non-empty and must begin with a '/': %v", *topoGlobalRoot)
if *topoGlobalRoot == "" {
log.Exit("topo_global_root must be non-empty")
}
ts, err := OpenServer(*topoImplementation, *topoGlobalServerAddress, *topoGlobalRoot)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go/vt/vtctl/cell_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ func commandAddCellInfo(ctx context.Context, wr *wrangler.Wrangler, subFlags *fl
if err := subFlags.Parse(args); err != nil {
return err
}
if !strings.HasPrefix(*root, "/") {
return fmt.Errorf("root must be non-empty and must begin with a '/': %v", *root)
if *root == "" {
return fmt.Errorf("root must be non-empty")
}
if subFlags.NArg() != 1 {
return fmt.Errorf("the <cell> argument is required for the AddCellInfo command")
Expand Down

0 comments on commit a129d14

Please sign in to comment.