status commands handle uuid prefixes with hyphens
This commit is contained in:
parent
25128c0b67
commit
8c1573642d
|
@ -142,7 +142,7 @@ func (c *AllocStatusCommand) Run(args []string) int {
|
|||
c.Ui.Error(fmt.Sprintf("Identifier must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
if len(allocID)%2 == 1 {
|
||||
if hyphens := strings.Count(allocID, "-"); (len(allocID)-hyphens)%2 == 1 {
|
||||
// Identifiers must be of even length, so we strip off the last byte
|
||||
// to provide a consistent user experience.
|
||||
allocID = allocID[:len(allocID)-1]
|
||||
|
|
|
@ -130,7 +130,7 @@ func (c *EvalStatusCommand) Run(args []string) int {
|
|||
c.Ui.Error(fmt.Sprintf("Identifier must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
if len(evalID)%2 == 1 {
|
||||
if hyphens := strings.Count(evalID, "-"); (len(evalID)-hyphens)%2 == 1 {
|
||||
// Identifiers must be of even length, so we strip off the last byte
|
||||
// to provide a consistent user experience.
|
||||
evalID = evalID[:len(evalID)-1]
|
||||
|
|
|
@ -169,7 +169,7 @@ func (f *FSCommand) Run(args []string) int {
|
|||
f.Ui.Error(fmt.Sprintf("Alloc ID must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
if len(allocID)%2 == 1 {
|
||||
if hyphens := strings.Count(allocID, "-"); (len(allocID)-hyphens)%2 == 1 {
|
||||
// Identifiers must be of even length, so we strip off the last byte
|
||||
// to provide a consistent user experience.
|
||||
allocID = allocID[:len(allocID)-1]
|
||||
|
|
|
@ -144,7 +144,7 @@ func (l *LogsCommand) Run(args []string) int {
|
|||
l.Ui.Error(fmt.Sprintf("Alloc ID must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
if len(allocID)%2 == 1 {
|
||||
if hyphens := strings.Count(allocID, "-"); (len(allocID)-hyphens)%2 == 1 {
|
||||
// Identifiers must be of even length, so we strip off the last byte
|
||||
// to provide a consistent user experience.
|
||||
allocID = allocID[:len(allocID)-1]
|
||||
|
|
|
@ -194,7 +194,7 @@ func (m *monitor) monitor(evalID string, allowPrefix bool) int {
|
|||
m.ui.Error(fmt.Sprintf("Identifier must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
if len(evalID)%2 == 1 {
|
||||
if hyphens := strings.Count(evalID, "-"); (len(evalID)-hyphens)%2 == 1 {
|
||||
// Identifiers must be of even length, so we strip off the last byte
|
||||
// to provide a consistent user experience.
|
||||
evalID = evalID[:len(evalID)-1]
|
||||
|
|
|
@ -117,7 +117,7 @@ func (c *NodeDrainCommand) Run(args []string) int {
|
|||
c.Ui.Error(fmt.Sprintf("Identifier must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
if len(nodeID)%2 == 1 {
|
||||
if hyphens := strings.Count(nodeID, "-"); (len(nodeID)-hyphens)%2 == 1 {
|
||||
// Identifiers must be of even length, so we strip off the last byte
|
||||
// to provide a consistent user experience.
|
||||
nodeID = nodeID[:len(nodeID)-1]
|
||||
|
|
|
@ -231,7 +231,7 @@ func (c *NodeStatusCommand) Run(args []string) int {
|
|||
c.Ui.Error(fmt.Sprintf("Identifier must contain at least two characters."))
|
||||
return 1
|
||||
}
|
||||
if len(nodeID)%2 == 1 {
|
||||
if hyphens := strings.Count(nodeID, "-"); (len(nodeID)-hyphens)%2 == 1 {
|
||||
// Identifiers must be of even length, so we strip off the last byte
|
||||
// to provide a consistent user experience.
|
||||
nodeID = nodeID[:len(nodeID)-1]
|
||||
|
|
Loading…
Reference in New Issue