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

exit with error on shadowed environment variables #8380

Closed
Tracked by #14438
heyitsanthony opened this issue Aug 9, 2017 · 6 comments
Closed
Tracked by #14438

exit with error on shadowed environment variables #8380

heyitsanthony opened this issue Aug 9, 2017 · 6 comments
Milestone

Comments

@heyitsanthony
Copy link
Contributor

Configure etcd to have both an environment variable and flag for some option:

$ export ETCD_WHATEVER=abc
$ etcd --whatever=def

etcd will warn that ETCD_WHATEVER is shadowed and use --whatever. Given a lot of documentation out there suggests using environment variables in drop-ins, I suspect this permissiveness leads to some degree of breakage. Is this worth deprecating away?

@gyuho
Copy link
Contributor

gyuho commented Aug 15, 2017

@heyitsanthony

I couldn't come up with any compelling reasons for why anyone would want shadowing besides backwards compat. Is 3.4 good for fatal or should it be deferred to later?

Let's fatal for 3.4? /cc @xiang90

@heyitsanthony heyitsanthony modified the milestones: v4.0.0, v3.4.0 Aug 15, 2017
@heyitsanthony
Copy link
Contributor Author

Marking as 4.0.0 so this can eventually fatal

@sh8121att
Copy link

I'm seeing 'etcdctl move-leader <some_id>' fail with a shadow message even when now CLI arg is provided:

# etcdctl member list
57da4560b50c8f03, started, auxiliary-0, https://172.24.1.10:12380, https://172.24.1.10:12379, false
a6103004597d4f6b, started, auxiliary-1, https://172.24.1.10:22380, https://172.24.1.10:22379, false
b6503c2150dedc1a, started, n0, https://172.24.1.10:2380, https://172.24.1.10:2379, false
# etcdctl move-leader b6503c2150dedc1a
2019-09-06 21:08:16.323276 C | pkg/flags: conflicting environment variable "ETCDCTL_CACERT" is shadowed by corresponding command-line flag (either unset environment variable or disable flag)
# etcdctl version
etcdctl version: 3.4.0
API version: 3.4

@C-PET
Copy link

C-PET commented Feb 27, 2020

seeing same issue in etcdctl 3.4.3 when trying to get endpoint status for all members

docker exec etcd etcdctl endpoint status --endpoints=$(docker exec etcd /bin/sh -c "etcdctl member list | cut -d, -f5 | sed -e 's/ //g' | paste -sd ','") --write-out table

 pkg/flags: conflicting environment variable "ETCDCTL_ENDPOINTS" is shadowed by corresponding command-line flag (either unset environment variable or disable flag)

the same above command worked in etcdctl 3.3.15

zerodayz added a commit to zerodayz/etcd that referenced this issue Mar 9, 2021
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.
zerodayz added a commit to zerodayz/etcd that referenced this issue Mar 10, 2021
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.
zerodayz added a commit to zerodayz/etcd that referenced this issue Mar 10, 2021
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.
zerodayz added a commit to zerodayz/etcd that referenced this issue Mar 11, 2021
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.
zerodayz added a commit to zerodayz/etcd that referenced this issue Jun 14, 2021
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.
zerodayz added a commit to zerodayz/etcd that referenced this issue Jun 14, 2021
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.
tjungblu added a commit to tjungblu/etcd that referenced this issue Aug 3, 2022
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.
Then again opened PR etcd-io#12757 which was authored by zerodayz.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.

Signed-off-by: Thomas Jungblut <[email protected]>
@mrnonz
Copy link

mrnonz commented Aug 4, 2022

Anyone has interim solution for etcdctl move-leader without waiting upgrade version?

@mrnonz
Copy link

mrnonz commented Aug 4, 2022

Anyone has interim solution for etcdctl move-leader without waiting upgrade version?

I founded interim solution is unset all ENV variable first and run by hand

unset ETCDCTL_CACERT
unset ETCDCTL_CERT
unset ETCDCTL_ENDPOINTS
unset ETCDCTL_KEY

etcdctl --endpoints XXXX --cacert XXX --cert XXX --key XXX move-leader ${transferee_id}

tjungblu added a commit to tjungblu/etcd that referenced this issue Sep 7, 2022
Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.
Then again opened PR etcd-io#12757 which was authored by zerodayz.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.

Signed-off-by: Thomas Jungblut <[email protected]>
tjungblu added a commit to tjungblu/etcd that referenced this issue Sep 7, 2022
…ndpoints

Re-opening closed PR etcd-io#11775 which was originaly authored by benmoss.
Then again opened PR etcd-io#12757 which was authored by zerodayz.

The mustClientForCmd function is responsible for parsing environment
variables and flags into configuration data. A change was made in etcd-io#9382
to call Fatal if a flag is provided multiple times. This means that we
cannot call the mustClientForCmd function more than once,
since it will think that flags parsed the first time are now
being redefined and error out.

Some people have commented about this in etcd-io#8380 but I don't think
there's an open issue for it.

Signed-off-by: Thomas Jungblut <[email protected]>
@ahrtr ahrtr mentioned this issue Sep 8, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants