Unverified Commit 3868e885 authored by James Rasell's avatar James Rasell
Browse files

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.
parent da9a1d7b
Showing with 6 additions and 3 deletions
+6 -3
...@@ -151,6 +151,7 @@ type HostDiskStats struct { ...@@ -151,6 +151,7 @@ type HostDiskStats struct {
// NodeListStub is a subset of information returned during // NodeListStub is a subset of information returned during
// node list operations. // node list operations.
type NodeListStub struct { type NodeListStub struct {
Address string
ID string ID string
Datacenter string Datacenter string
Name string Name string
......
...@@ -180,7 +180,7 @@ func (c *NodeStatusCommand) Run(args []string) int { ...@@ -180,7 +180,7 @@ func (c *NodeStatusCommand) Run(args []string) int {
out[0] = "ID|DC|Name|Class|" out[0] = "ID|DC|Name|Class|"
if c.verbose { if c.verbose {
out[0] += "Version|" out[0] += "Address|Version|"
} }
out[0] += "Drain|Status" out[0] += "Drain|Status"
...@@ -196,8 +196,8 @@ func (c *NodeStatusCommand) Run(args []string) int { ...@@ -196,8 +196,8 @@ func (c *NodeStatusCommand) Run(args []string) int {
node.Name, node.Name,
node.NodeClass) node.NodeClass)
if c.verbose { if c.verbose {
out[i+1] += fmt.Sprintf("|%s", out[i+1] += fmt.Sprintf("|%s|%s",
node.Version) node.Address, node.Version)
} }
out[i+1] += fmt.Sprintf("|%v|%s", out[i+1] += fmt.Sprintf("|%v|%s",
node.Drain, node.Drain,
......
...@@ -1172,6 +1172,7 @@ func (n *Node) TerminalStatus() bool { ...@@ -1172,6 +1172,7 @@ func (n *Node) TerminalStatus() bool {
// Stub returns a summarized version of the node // Stub returns a summarized version of the node
func (n *Node) Stub() *NodeListStub { func (n *Node) Stub() *NodeListStub {
return &NodeListStub{ return &NodeListStub{
Address: n.Attributes["unique.network.ip-address"],
ID: n.ID, ID: n.ID,
Datacenter: n.Datacenter, Datacenter: n.Datacenter,
Name: n.Name, Name: n.Name,
...@@ -1188,6 +1189,7 @@ func (n *Node) Stub() *NodeListStub { ...@@ -1188,6 +1189,7 @@ func (n *Node) Stub() *NodeListStub {
// NodeListStub is used to return a subset of job information // NodeListStub is used to return a subset of job information
// for the job list // for the job list
type NodeListStub struct { type NodeListStub struct {
Address string
ID string ID string
Datacenter string Datacenter string
Name string Name string
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment