Skip to content

Commit

Permalink
Merge pull request #1841 from hashicorp/f-node-meta
Browse files Browse the repository at this point in the history
Output Node meta in verbose mode
  • Loading branch information
dadgar committed Oct 24, 2016
2 parents a877e32 + bdf452b commit b5990a0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions command/node_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ func (c *NodeStatusCommand) formatNode(client *api.Client, node *api.Node) int {

if c.verbose {
c.formatAttributes(node)
c.formatMeta(node)
}
return 0

Expand All @@ -382,6 +383,24 @@ func (c *NodeStatusCommand) formatAttributes(node *api.Node) {
c.Ui.Output(formatKV(attributes))
}

func (c *NodeStatusCommand) formatMeta(node *api.Node) {
// Print the meta
keys := make([]string, 0, len(node.Meta))
for k := range node.Meta {
keys = append(keys, k)
}
sort.Strings(keys)

var meta []string
for _, k := range keys {
if k != "" {
meta = append(meta, fmt.Sprintf("%s|%s", k, node.Meta[k]))
}
}
c.Ui.Output(c.Colorize().Color("\n[bold]Meta[reset]"))
c.Ui.Output(formatKV(meta))
}

func (c *NodeStatusCommand) printCpuStats(hostStats *api.HostStats) {
l := len(hostStats.CPU)
for i, cpuStat := range hostStats.CPU {
Expand Down

0 comments on commit b5990a0

Please sign in to comment.