Skip to content

Commit

Permalink
roachprod: make it possible to use -e multiple times
Browse files Browse the repository at this point in the history
This way it's possible to pass env vars using `-e` assembled from
multiple strings.

Also this fixes how `cassandra` was invoked when `-e` was also
specified.

Release note: None
  • Loading branch information
knz committed Sep 11, 2020
1 parent bdcb2f7 commit 114eeb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/roachprod/install/cassandra.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (Cassandra) Start(c *SyncedCluster, extraArgs []string) {
_ = session.Close()
}()

cmd := c.Env + `env ROACHPROD=true cassandra` +
cmd := `env ` + c.Env + ` ROACHPROD=true cassandra` +
` -Dcassandra.config=file://${PWD}/cassandra.yaml` +
` -Dcassandra.ring_delay_ms=3000` +
` > cassandra.stdout 2> cassandra.stderr`
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/roachprod/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var (
listMine bool
clusterType = "cockroach"
secure = false
nodeEnv = "COCKROACH_ENABLE_RPC_COMPRESSION=false"
nodeEnv = []string{"COCKROACH_ENABLE_RPC_COMPRESSION=false"}
nodeArgs []string
tag string
external = false
Expand Down Expand Up @@ -175,7 +175,7 @@ Available clusters:
}
c.Nodes = nodes
c.Secure = secure
c.Env = nodeEnv
c.Env = strings.Join(nodeEnv, " ")
c.Args = nodeArgs
if tag != "" {
c.Tag = "/" + tag
Expand Down Expand Up @@ -1777,7 +1777,7 @@ func main() {
"start nodes sequentially so node IDs match hostnames")
cmd.Flags().StringArrayVarP(
&nodeArgs, "args", "a", nil, "node arguments")
cmd.Flags().StringVarP(
cmd.Flags().StringArrayVarP(
&nodeEnv, "env", "e", nodeEnv, "node environment variables")
cmd.Flags().StringVarP(
&clusterType, "type", "t", clusterType, `cluster type ("cockroach" or "cassandra")`)
Expand Down

0 comments on commit 114eeb7

Please sign in to comment.