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: Show leader status in json output of server members #17138

Merged
merged 3 commits into from
May 18, 2023

Conversation

Yethal
Copy link
Contributor

@Yethal Yethal commented May 10, 2023

Leader status is shown in regular table output but not in json output.

@hashicorp-cla
Copy link

hashicorp-cla commented May 10, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

Thanks @Yethal! We'll need a changelog entry for this. I would have just pushed a commit myself but you've marked the PR as unable to be edited by maintainers. If you run make cl it'll ask you for the inputs, which will result in a file with contents like this:

```release-note:improvement
cli: Add leader status to output of nomad server members -json
```


example of use
$ nomad server members -json
[
    {
        "Addr": "192.168.1.46",
        "DelegateCur": 4,
        "DelegateMax": 5,
        "DelegateMin": 2,
        "Name": "server0.global",
        "Port": 4648,
        "ProtocolCur": 2,
        "ProtocolMax": 5,
        "ProtocolMin": 1,
        "Status": "alive",
        "Tags": {
            "region": "global",
            "expect": "3",
            "role": "nomad",
            "dc": "dc1",
            "revision": "7fc37fa2adf1c2450b2203376f25efe66fa06655",
            "id": "e58c694c-7fff-00d9-cec0-f5da1340840e",
            "Leader": "false",
            "rpc_addr": "192.168.1.46",
            "port": "4647",
            "build": "1.5.4-dev",
            "vsn": "1",
            "raft_vsn": "3"
        }
    },
    {
        "Addr": "192.168.1.46",
        "DelegateCur": 4,
        "DelegateMax": 5,
        "DelegateMin": 2,
        "Name": "server1.global",
        "Port": 4658,
        "ProtocolCur": 2,
        "ProtocolMax": 5,
        "ProtocolMin": 1,
        "Status": "alive",
        "Tags": {
            "id": "dbd5c46f-fbc7-9c9a-33b6-2aa5fe3534da",
            "expect": "3",
            "dc": "dc1",
            "raft_vsn": "3",
            "role": "nomad",
            "build": "1.5.4-dev",
            "vsn": "1",
            "port": "4657",
            "Leader": "true",
            "rpc_addr": "192.168.1.46",
            "region": "global",
            "revision": "7fc37fa2adf1c2450b2203376f25efe66fa06655"
        }
    },
    {
        "Addr": "192.168.1.46",
        "DelegateCur": 4,
        "DelegateMax": 5,
        "DelegateMin": 2,
        "Name": "server2.global",
        "Port": 4668,
        "ProtocolCur": 2,
        "ProtocolMax": 5,
        "ProtocolMin": 1,
        "Status": "alive",
        "Tags": {
            "rpc_addr": "192.168.1.46",
            "region": "global",
            "build": "1.5.4-dev",
            "expect": "3",
            "dc": "dc1",
            "Leader": "false",
            "vsn": "1",
            "raft_vsn": "3",
            "id": "4184acc7-e1e4-504e-fa0f-c8f38510fd17",
            "role": "nomad",
            "revision": "7fc37fa2adf1c2450b2203376f25efe66fa06655",
            "port": "4667"
        }
    }
]

$ nomad server members
Name            Address       Port  Status  Leader  Raft Version  Build      Datacenter  Region
server0.global  192.168.1.46  4648  alive   false   3             1.5.4-dev  dc1         global
server1.global  192.168.1.46  4658  alive   true    3             1.5.4-dev  dc1         global
server2.global  192.168.1.46  4668  alive   false   3             1.5.4-dev  dc1         global

Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @Yethal!

I'll get this merged once CI finishes and then it'll go out in 1.6.0

@tgross tgross added this to the 1.6.0 milestone May 18, 2023
@tgross tgross merged commit 93fc71b into hashicorp:main May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

3 participants