Skip to content

etcdctl member add -wjson --hex=true does not output member IDs in hex #19262

Open
@kwohlfahrt

Description

@kwohlfahrt

Bug report criteria

What happened?

I ran etcdctl member add -w json --hex=true, with the aim of extracting the newly added member ID for use with etcdctl member promote later. However, the member ID was printed as decimal:

> etcdctl member add test-node --peer-urls=https://10.16.36.111:2380 --learner=true -w json --hex=true
{"header":{"cluster_id":8614491861582198852,"member_id":9202843606982955899,"raft_term":2},"member":{"ID":12981492951526344977,"peerURLs":["https://10.16.36.111:2380"],"isLearner":true},"members":[{"ID":677637297205855628,"name":"etcd-i-0287724fa565aba47","peerURLs":["https://10.16.43.142:2380"],"clientURLs":["https://10.16.43.142:2379"]},{"ID":9202843606982955899,"name":"etcd-i-0a11bcfc6be104246","peerURLs":["https://10.16.33.50:2380"],"clientURLs":["https://10.16.33.50:2379"]},{"ID":12981492951526344977,"peerURLs":["https://10.16.36.111:2380"],"isLearner":true},{"ID":16455373321881049425,"name":"etcd-i-0e6aa2e540fd3c248","peerURLs":["https://10.16.36.53:2380"],"clientURLs":["https://10.16.36.53:2379"]}]

This does not match the behaviour of etcdctl member list -w json --hex=true, which prints the member IDs in hexadecimal, compatible for use with other etcdctl commands.

What did you expect to happen?

I expect etcdctl member add ... -w json --hex=true to print the IDs in hexadecimal, just like etcdctl member list does.

How can we reproduce it (as minimally and precisely as possible)?

Run the following command (the new member doesn't actually ever have to join the cluster, it can be immediately deleted afterwards):

etcdctl member add test-node --peer-urls=https://10.16.36.111:2380 --learner=true -w json --hex=true

Anything else we need to know?

No response

Etcd version (please run commands below)

$ etcd --version
etcd Version: 3.5.15
Git SHA: 9a5533382
Go Version: go1.21.12
Go OS/Arch: linux/arm64

$ etcdctl version
etcdctl version: 3.5.15
API version: 3.5

Etcd configuration (command line flags or environment variables)

paste your configuration here

Etcd debug information (please run commands below, feel free to obfuscate the IP address or FQDN in the output)

$ etcdctl member list -w table
# paste output here

$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here

Relevant log output

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions