-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Show node attribute in node-status #313
Conversation
Currently this looks like this:
Trying to see how to make this equally human and machine readable. Open to feedback. |
@@ -111,6 +116,7 @@ func (c *NodeStatusCommand) Run(args []string) int { | |||
fmt.Sprintf("Datacenter|%s", node.Datacenter), | |||
fmt.Sprintf("Drain|%v", node.Drain), | |||
fmt.Sprintf("Status|%s", node.Status), | |||
fmt.Sprintf("Attributes|%s", strings.Join(attributes, ", ")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent is off by one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because of the + sign. If you click on 'View', you will see that it lines up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is because that line uses spaces instead of tabs. gofmt
should fix it. @achanda Not sure which editor you use but I have mine set to run gofmt
when I save a file -- helps with things like this.
var attributes []string | ||
for k, v := range node.Attributes { | ||
attributes = append(attributes, fmt.Sprintf("%s:%s", k, v)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would sort the keys and then create the attributes by iterating through the sorted keys and making the list. That way looking for a particular attribute in the output will be a lot easier!
Adds node attributes to the node-status command when a single node ID is passed
Example looks like
|
Awesome! Thanks @achanda |
Show node attribute in node-status
InmemTransport: respect timeout when sending
I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions. |
Adds node attributes to the node-status command when a single
node ID is passed
Closes #303