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

Consistently sort output of Nomad CLI #13711

Closed
alexiri opened this issue Jul 12, 2022 · 1 comment · Fixed by #16221
Closed

Consistently sort output of Nomad CLI #13711

alexiri opened this issue Jul 12, 2022 · 1 comment · Fixed by #16221
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/cli type/enhancement

Comments

@alexiri
Copy link
Contributor

alexiri commented Jul 12, 2022

Proposal

The output of nomad server members and nomad node status is sorted alphabetically by Name, but nomad operator raft list-peers does not seem to be sorted, or at least not by Node. I think it would make sense that CLI output is sorted by Name/Node consistently.

Use-cases

This would make it easier to find a particular node within the output of the CLI.

Attempted Solutions

nomad operator raft list-peers | sort kind of works, but it's not a great solution. 😄

@tgross
Copy link
Member

tgross commented Jul 25, 2022

Hi @alexiri! This seems like a nice quality of life improvement that could be added to the formatting code at operator_raft_list.go#L85-L97. I'll add this to the roadmap, but I'd also be happy to review a PR if you're interested in giving it a try yourself!

For sake of comparison, here's my local development cluster:

$ nomad server members
Name                  Address        Port  Status  Leader  Raft Version  Build      Datacenter  Region
nomad-server0.global  192.168.56.10  4648  alive   false   3             1.3.3-dev  dc1         global
nomad-server1.global  192.168.56.20  4648  alive   true    3             1.3.3-dev  dc1         global
nomad-server2.global  192.168.56.30  4648  alive   false   3             1.3.3-dev  dc1         global

$ nomad operator raft list-peers
Node                  ID                                    Address             State     Voter  RaftProtocol
nomad-server1.global  7590ad0d-ae64-baa9-d5fb-29eb15e02d99  192.168.56.20:4647  leader    true   3
nomad-server0.global  e593252c-cb3c-2ef2-f7d4-5bc5aa84477a  192.168.56.10:4647  follower  true   3
nomad-server2.global  2ad25527-dc71-a8d7-b752-64d0997a275f  192.168.56.30:4647  follower  true   3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. theme/cli type/enhancement
Projects
Development

Successfully merging a pull request may close this issue.

2 participants