Skip to content

Commit

Permalink
Merge pull request #9007 from mjibson/zone
Browse files Browse the repository at this point in the history
cli: don't output SQL results during zone set
  • Loading branch information
maddyblue authored Sep 1, 2016
2 parents b91954a + 523c510 commit 18929ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
3 changes: 0 additions & 3 deletions cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,6 @@ func Example_zone() {
// zone ls
// .default
// zone set system --file=./testdata/zone_attrs.yaml
// INSERT 1
// range_min_bytes: 1048576
// range_max_bytes: 67108864
// gc:
Expand All @@ -523,7 +522,6 @@ func Example_zone() {
// num_replicas: 1
// constraints: [us-east-1a, ssd]
// zone set system --file=./testdata/zone_range_max_bytes.yaml
// UPDATE 1
// range_min_bytes: 1048576
// range_max_bytes: 134217728
// gc:
Expand All @@ -545,7 +543,6 @@ func Example_zone() {
// zone rm .default
// unable to remove .default
// zone set .default --file=./testdata/zone_range_max_bytes.yaml
// UPDATE 1
// range_min_bytes: 1048576
// range_max_bytes: 134217728
// gc:
Expand Down
12 changes: 4 additions & 8 deletions cli/zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ func runSetZone(cmd *cobra.Command, args []string) error {
return err
}

zoneID, zone, err := queryZonePath(conn, path)
_, zone, err := queryZonePath(conn, path)
if err != nil {
return err
}
Expand Down Expand Up @@ -486,13 +486,9 @@ func runSetZone(cmd *cobra.Command, args []string) error {
}

id := path[len(path)-1]
if id == zoneID {
err = runQueryAndFormatResults(conn, os.Stdout,
makeQuery(`UPDATE system.zones SET config = $2 WHERE id = $1`, id, buf), cliCtx.prettyFmt)
} else {
err = runQueryAndFormatResults(conn, os.Stdout,
makeQuery(`INSERT INTO system.zones VALUES ($1, $2)`, id, buf), cliCtx.prettyFmt)
}
_, _, _, err = runQuery(conn, makeQuery(
`UPSERT INTO system.zones (id, config) VALUES ($1, $2)`,
id, buf), false)
if err != nil {
return err
}
Expand Down

0 comments on commit 18929ed

Please sign in to comment.