Merge pull request #3002 from jrasell/gh_2993
Add the Nomad agent version to the node-status CLI output.
This commit is contained in:
commit
422332c8bf
|
@ -169,6 +169,7 @@ type NodeListStub struct {
|
||||||
Datacenter string
|
Datacenter string
|
||||||
Name string
|
Name string
|
||||||
NodeClass string
|
NodeClass string
|
||||||
|
Version string
|
||||||
Drain bool
|
Drain bool
|
||||||
Status string
|
Status string
|
||||||
StatusDescription string
|
StatusDescription string
|
||||||
|
|
|
@ -59,7 +59,7 @@ Node Status Options:
|
||||||
-self
|
-self
|
||||||
Query the status of the local node.
|
Query the status of the local node.
|
||||||
|
|
||||||
-stats
|
-stats
|
||||||
Display detailed resource usage statistics.
|
Display detailed resource usage statistics.
|
||||||
|
|
||||||
-allocs
|
-allocs
|
||||||
|
@ -150,35 +150,40 @@ func (c *NodeStatusCommand) Run(args []string) int {
|
||||||
|
|
||||||
// Format the nodes list
|
// Format the nodes list
|
||||||
out := make([]string, len(nodes)+1)
|
out := make([]string, len(nodes)+1)
|
||||||
|
|
||||||
|
out[0] = "ID|DC|Name|Class|"
|
||||||
|
|
||||||
|
if c.verbose {
|
||||||
|
out[0] += "Version|"
|
||||||
|
}
|
||||||
|
|
||||||
|
out[0] += "Drain|Status"
|
||||||
|
|
||||||
if c.list_allocs {
|
if c.list_allocs {
|
||||||
out[0] = "ID|DC|Name|Class|Drain|Status|Running Allocs"
|
out[0] += "|Running Allocs"
|
||||||
} else {
|
|
||||||
out[0] = "ID|DC|Name|Class|Drain|Status"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, node := range nodes {
|
for i, node := range nodes {
|
||||||
|
out[i+1] = fmt.Sprintf("%s|%s|%s|%s",
|
||||||
|
limit(node.ID, c.length),
|
||||||
|
node.Datacenter,
|
||||||
|
node.Name,
|
||||||
|
node.NodeClass)
|
||||||
|
if c.verbose {
|
||||||
|
out[i+1] += fmt.Sprintf("|%s",
|
||||||
|
node.Version)
|
||||||
|
}
|
||||||
|
out[i+1] += fmt.Sprintf("|%v|%s",
|
||||||
|
node.Drain,
|
||||||
|
node.Status)
|
||||||
if c.list_allocs {
|
if c.list_allocs {
|
||||||
numAllocs, err := getRunningAllocs(client, node.ID)
|
numAllocs, err := getRunningAllocs(client, node.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Ui.Error(fmt.Sprintf("Error querying node allocations: %s", err))
|
c.Ui.Error(fmt.Sprintf("Error querying node allocations: %s", err))
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
out[i+1] = fmt.Sprintf("%s|%s|%s|%s|%v|%s|%v",
|
out[i+1] += fmt.Sprintf("|%v",
|
||||||
limit(node.ID, c.length),
|
|
||||||
node.Datacenter,
|
|
||||||
node.Name,
|
|
||||||
node.NodeClass,
|
|
||||||
node.Drain,
|
|
||||||
node.Status,
|
|
||||||
len(numAllocs))
|
len(numAllocs))
|
||||||
} else {
|
|
||||||
out[i+1] = fmt.Sprintf("%s|%s|%s|%s|%v|%s",
|
|
||||||
limit(node.ID, c.length),
|
|
||||||
node.Datacenter,
|
|
||||||
node.Name,
|
|
||||||
node.NodeClass,
|
|
||||||
node.Drain,
|
|
||||||
node.Status)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1070,6 +1070,7 @@ func (n *Node) Stub() *NodeListStub {
|
||||||
Datacenter: n.Datacenter,
|
Datacenter: n.Datacenter,
|
||||||
Name: n.Name,
|
Name: n.Name,
|
||||||
NodeClass: n.NodeClass,
|
NodeClass: n.NodeClass,
|
||||||
|
Version: n.Attributes["nomad.version"],
|
||||||
Drain: n.Drain,
|
Drain: n.Drain,
|
||||||
Status: n.Status,
|
Status: n.Status,
|
||||||
StatusDescription: n.StatusDescription,
|
StatusDescription: n.StatusDescription,
|
||||||
|
@ -1085,6 +1086,7 @@ type NodeListStub struct {
|
||||||
Datacenter string
|
Datacenter string
|
||||||
Name string
|
Name string
|
||||||
NodeClass string
|
NodeClass string
|
||||||
|
Version string
|
||||||
Drain bool
|
Drain bool
|
||||||
Status string
|
Status string
|
||||||
StatusDescription string
|
StatusDescription string
|
||||||
|
|
Loading…
Reference in New Issue