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

Improve memberList output consistency #15023

Merged

Conversation

unai-ttxu
Copy link
Contributor

@unai-ttxu unai-ttxu commented Dec 19, 2022

After merging #11812, hexadecimal format for member IDs was added when json output format and --hex flag are used.

But, comparing the output of the etcdctl member list -w json and etcdctl member list -w json --hex there is one subtle difference which, I think, broke consistency.

  • etcdctl member list -w json:
{
  "header": {
    "cluster_id": 8901668306595756000,
    "member_id": 13919521250792505000,
    "raft_term": 8
  },
  "members": [
    {
      "ID": 1373433005507466200,
      "name": "etcd2",
      "peerURLs": [
        "https://10.200.18.14:2380"
      ],
      "clientURLs": [
        "https://10.200.18.14:2379"
      ]
    },
    {
      "ID": 2234793613784549000,
      "name": "etcd3",
      "peerURLs": [
        "https://10.200.18.16:2380"
      ],
      "clientURLs": [
        "https://10.200.18.16:2379"
      ]
    },
    {
      "ID": 13919521250792505000,
      "name": "etcd1",
      "peerURLs": [
        "https://10.200.18.15:2380"
      ],
      "clientURLs": [
        "https://10.200.18.15:2379"
      ]
    }
  ]
}
  • etcdctl member list -w json --hex:
{
  "header": {
    "cluster_id": "7b8914296afe3773",
    "member_id": "c12c12d42cfd010e",
    "raft_term": 8
  },
  "members": [
    {
      "ID": "130f6a0ab011d407",
      "name": "etcd2",
      "peerURLs": [
        "https://10.200.18.14:2380"
      ],
      "clientURLS": [
        "https://10.200.18.14:2379"
      ]
    },
    {
      "ID": "1f0394f387f08727",
      "name": "etcd3",
      "peerURLs": [
        "https://10.200.18.16:2380"
      ],
      "clientURLS": [
        "https://10.200.18.16:2379"
      ]
    },
    {
      "ID": "c12c12d42cfd010e",
      "name": "etcd1",
      "peerURLs": [
        "https://10.200.18.15:2380"
      ],
      "clientURLS": [
        "https://10.200.18.15:2379"
      ]
    }
  ]
}

As we can see, besides the format of the member ID, client URLs key changes from clientURLs to clientURLS when --hex flag is used.

This PR will set clientURLs as key value for any type of format output in order to improve consistency.

Signed-off-by: Unai Arrien <unaittxu@gmail.com>
@unai-ttxu unai-ttxu force-pushed the task/fix_etcdctl_member_list_hex_consistency branch from 6110795 to 8a75cff Compare December 19, 2022 12:09
Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thank you @unai-ttxu

@ahrtr ahrtr merged commit dc680e3 into etcd-io:main Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants