Update node-status verbose command to include node address.

This change updates the `nomad node-status -verbose` command to
also include the addreess of the node. This is helpful for cluster
administrators to quickly discover information and access nodes
when required.
This commit is contained in:
James Rasell 2017-12-21 08:58:35 +00:00
parent be33e0bb7e
commit 45e8f977f7
No known key found for this signature in database
GPG key ID: AA7D460F5C8377AA
3 changed files with 6 additions and 3 deletions

View file

@ -151,6 +151,7 @@ type HostDiskStats struct {
// NodeListStub is a subset of information returned during
// node list operations.
type NodeListStub struct {
Address string
ID string
Datacenter string
Name string

View file

@ -180,7 +180,7 @@ func (c *NodeStatusCommand) Run(args []string) int {
out[0] = "ID|DC|Name|Class|"
if c.verbose {
out[0] += "Version|"
out[0] += "Address|Version|"
}
out[0] += "Drain|Status"
@ -196,8 +196,8 @@ func (c *NodeStatusCommand) Run(args []string) int {
node.Name,
node.NodeClass)
if c.verbose {
out[i+1] += fmt.Sprintf("|%s",
node.Version)
out[i+1] += fmt.Sprintf("|%s|%s",
node.Address, node.Version)
}
out[i+1] += fmt.Sprintf("|%v|%s",
node.Drain,

View file

@ -1172,6 +1172,7 @@ func (n *Node) TerminalStatus() bool {
// Stub returns a summarized version of the node
func (n *Node) Stub() *NodeListStub {
return &NodeListStub{
Address: n.Attributes["unique.network.ip-address"],
ID: n.ID,
Datacenter: n.Datacenter,
Name: n.Name,
@ -1188,6 +1189,7 @@ func (n *Node) Stub() *NodeListStub {
// NodeListStub is used to return a subset of job information
// for the job list
type NodeListStub struct {
Address string
ID string
Datacenter string
Name string