mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Output Node meta in verbose mode
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user