Repository navigation
fix(cli): show the host address and state in get hosts - #58
Merged
Merged
Conversation
The hosts table read an "addresses" field the controller never sends, so the ADDRESSES column was always empty. The table now reads the single "address" field and shows the port range, online state and the number of instances the agent reported. The memory column is dropped: agents that do not report capacity left it empty, and it stays visible in -o json and -o yaml.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Running `grus get hosts` against a real controller printed the hosts with an empty ADDRESSES column, and the memory column was empty too. An operator looking for where a host can be reached saw nothing, even though the controller knew the address and the port range.
Approach
The CLI was looking for a field the controller never sends. It now reads the address and port range the agent reports and shows whether the host is online and how many instances it runs. The table is NAME, VERSION, ADDRESS, PORTS, ONLINE, INSTANCES and LAST-SEEN.
The memory column is gone from the table. Agents that do not report their capacity left it empty for every host, so it added nothing. The full data stays available with `-o json` and `-o yaml`.
Testing
A CLI test feeds the command the host shape the controller really returns and checks the header and the row. It failed before the change and passes after it. The client and CLI packages pass, and build, vet and gofmt are clean.