Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: Keep client and server flags more separate #14612

Merged
merged 1 commit into from
Apr 4, 2017

Conversation

a-robinson
Copy link
Contributor

@a-robinson a-robinson commented Apr 4, 2017

Prior to this, the client port flag's environment variable could get
pulled in and used by the server even though the server's port flag
isn't supposed to support being set by an env variable.

That's the problem with setting package globals for these. It'd be nice
to only even define the flags for the command being run, but that's
tricky to do with pflags since all of its "PreRun" functionality runs
after flags have already been parsed.

Fixes #8876. cc #9189

@mberhault


This change is Reviewable

Prior to this, the client port flag's environment variable could get
pulled in and used by the server even though the server's port flag
isn't supposed to support being set by an env variable.

That's the problem with setting package globals for these. It'd be nice
to only even define the flags for the command being run, but that's
tricky to do with pflags since all of its "PreRun" functionality runs
after flags have already been parsed.
@mberhault
Copy link
Contributor

LGTM

@a-robinson a-robinson merged commit 5081891 into cockroachdb:master Apr 4, 2017
a-robinson added a commit to a-robinson/cockroach that referenced this pull request Apr 7, 2017
They were broken by cockroachdb#14612 in a very bad way. We were always resetting
the base.Config's Addr and AdvertiseAddr in the last couple assignments
of `extraFlagInit`, such that the host/advertise-host flags actually
don't do anything, and such that the port flag doesn't do anything when
not running in insecure mode.

I've added some tests, but we'd probably be better off testing this by
going through the entire `cockroach start` machinery with a few
different variations. Does that fit best under the acceptance tests?
Or the cli Example_xxx tests?

Fixes cockroachdb#14681 (once a new "latest" docker image is cut).
a-robinson added a commit to a-robinson/cockroach that referenced this pull request Apr 7, 2017
They were broken by cockroachdb#14612 in a very bad way. We were always resetting
the base.Config's Addr and AdvertiseAddr in the last couple assignments
of `extraFlagInit`, such that the host/advertise-host flags actually
don't do anything, and such that the port flag doesn't do anything when
not running in insecure mode.

I've added some tests, but we'd probably be better off testing this by
going through the entire `cockroach start` machinery with a few
different variations. Does that fit best under the acceptance tests?
Or the cli Example_xxx tests?

Fixes cockroachdb#14681 (once a new "latest" docker image is cut).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants