Allows a node uuid prefix to be passed in
This commit is contained in:
parent
850ca88635
commit
7ca6dbe61e
|
@ -89,6 +89,28 @@ func (c *MonitorCommand) Run(args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
// Query the node info and lookup prefix
|
||||
if len(nodeID) == 1 {
|
||||
c.Ui.Error(fmt.Sprintf("Node identifier must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
|
||||
if nodeID != "" {
|
||||
nodeID = sanitizeUUIDPrefix(nodeID)
|
||||
nodes, _, err := client.Nodes().PrefixList(nodeID)
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error querying node: %v", err))
|
||||
return 1
|
||||
}
|
||||
|
||||
if len(nodes) > 1 {
|
||||
out := formatNodeStubList(nodes, false)
|
||||
c.Ui.Output(fmt.Sprintf("Prefix matched multiple nodes\n\n%s", out))
|
||||
return 1
|
||||
}
|
||||
nodeID = nodes[0].ID
|
||||
}
|
||||
|
||||
params := map[string]string{
|
||||
"log_level": logLevel,
|
||||
"node_id": nodeID,
|
||||
|
|
Loading…
Reference in New Issue