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

etcdctl unsetting ETCDCTL_API in lock exec #10840

Closed
devinrsmith opened this issue Jun 21, 2019 · 2 comments · Fixed by #11138
Closed

etcdctl unsetting ETCDCTL_API in lock exec #10840

devinrsmith opened this issue Jun 21, 2019 · 2 comments · Fixed by #11138
Assignees

Comments

@devinrsmith
Copy link

etcdctl lock <lockname> exec appears to be unsetting the environment variable ETCDCTL_API for the executed command. (And it might be unsetting other ETCDCTL_X variables, I haven't checked...)

For example:

13:59 $ MY_API=3 ETCDCTL_API=3 etcdctl lock /locks env | grep API
MY_API=3
✔ ~

Only MY_API shows up in the output.

13:59 $ etcd --version
etcd Version: 3.3.12
Git SHA: GitNotFound
Go Version: go1.11.5
Go OS/Arch: darwin/amd64
✔ ~
@spzala spzala self-assigned this Jul 7, 2019
@spzala
Copy link
Member

spzala commented Aug 13, 2019

Investigating

@spzala
Copy link
Member

spzala commented Aug 27, 2019

@devinrsmith that's true and this behavior is per design as it seems. The unsetting of the env variable ETCDCTL_API happens here:
https://github.com/etcd-io/etcd/blob/master/etcdctl/main.go#L33
Also, the usage of prefix ETCDCTL_ throws this error as an example:
2019-08-26 22:03:41.908806 W | pkg/flags: unrecognized environment variable ETCDCTL_X=3
https://github.com/etcd-io/etcd/blob/master//pkg/flags/flag.go#L86

I think documenting this behavior seems probably a good option. I will create a PR for it. Thanks!

/cc @xiang90 @gyuho

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants