debug: ignore invalid target flags (#7860)

This commit is contained in:
Calvin Leung Huang
2019-11-11 15:32:11 -08:00
committed by Brian Kassouf
parent 0e7604ca50
commit fcf30cc328
2 changed files with 17 additions and 0 deletions

View File

@@ -389,6 +389,13 @@ func (c *DebugCommand) preflight(rawArgs []string) (string, error) {
if len(c.flagTargets) == 0 {
c.flagTargets = c.defaultTargets()
} else {
// Check for any invalid targets and ignore them if found
invalidTargets := strutil.Difference(c.flagTargets, c.defaultTargets(), true)
if len(invalidTargets) != 0 {
c.UI.Info(fmt.Sprintf("Ignoring invalid targets: %s", strings.Join(invalidTargets, ", ")))
c.flagTargets = strutil.Difference(c.flagTargets, invalidTargets, true)
}
}
// Make sure we can talk to the server