Skip to content

Commit

Permalink
roachprod: fix roachprod start ignoring --binary flag
Browse files Browse the repository at this point in the history
Merging cockroachdb#71660 introduced a bug where roachprod ignores --binary
flag when running `roachprod start`.

This patch reverts to the old way of setting config.Binary.

Release note: None

Fixes cockroachdb#72425 cockroachdb#72420 cockroachdb#72373 cockroachdb#72372
  • Loading branch information
Ahmad Abedalqader authored and RaduBerinde committed Nov 15, 2021
1 parent 273eecc commit bae8cbc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
35 changes: 17 additions & 18 deletions pkg/cmd/roachprod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,21 @@ destroy the cluster.
}

var (
numNodes int
numRacks int
username string
dryrun bool
destroyAllMine bool
destroyAllLocal bool
extendLifetime time.Duration
wipePreserveCerts bool
listDetails bool
listJSON bool
listMine bool
listPattern string
sqlCockroachBinary = "cockroach"
secure = false
extraSSHOptions = ""
nodeEnv = []string{
numNodes int
numRacks int
username string
dryrun bool
destroyAllMine bool
destroyAllLocal bool
extendLifetime time.Duration
wipePreserveCerts bool
listDetails bool
listJSON bool
listMine bool
listPattern string
secure = false
extraSSHOptions = ""
nodeEnv = []string{
"COCKROACH_ENABLE_RPC_COMPRESSION=false",
"COCKROACH_UI_RELEASE_NOTES_SIGNUP_DISMISSED=true",
}
Expand Down Expand Up @@ -795,7 +794,7 @@ var sqlCmd = &cobra.Command{
Long: "Run `cockroach sql` on a remote cluster.\n",
Args: cobra.MinimumNArgs(1),
Run: wrap(func(cmd *cobra.Command, args []string) error {
return roachprod.SQL(clusterOpts(args[0]), sqlCockroachBinary, args[1:])
return roachprod.SQL(clusterOpts(args[0]), args[1:])
}),
}

Expand Down Expand Up @@ -1134,7 +1133,7 @@ func main() {
fallthrough
case sqlCmd:
cmd.Flags().StringVarP(
&sqlCockroachBinary, "binary", "b", "cockroach",
&config.Binary, "binary", "b", config.Binary,
"the remote cockroach binary to use")
fallthrough
case pgurlCmd, adminurlCmd:
Expand Down
3 changes: 1 addition & 2 deletions pkg/roachprod/roachprod.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ func Run(clusterOpts install.SyncedCluster, SSHOptions string, cmdArray []string
}

// SQL runs `cockroach sql` on a remote cluster.
func SQL(clusterOpts install.SyncedCluster, remoteCockroachBinary string, cmdArray []string) error {
config.Binary = remoteCockroachBinary
func SQL(clusterOpts install.SyncedCluster, cmdArray []string) error {
c, err := newCluster(clusterOpts)
if err != nil {
return err
Expand Down

0 comments on commit bae8cbc

Please sign in to comment.