Skip to content

Commit 8f14e8a

Browse files
author
Matthew Fisher
committed
fix(client): destroy all units if none specified
1 parent 06f903f commit 8f14e8a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

client/destroy.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,18 @@ import (
1010
// Destroy units for a given target
1111
func (c *FleetClient) Destroy(target string) (err error) {
1212
// check if the unit exists
13-
if _, err := c.Units(target); err != nil {
13+
units, err := c.Units(target)
14+
if err != nil {
1415
return err
1516
}
1617
component, num, err := splitTarget(target)
1718
if err != nil {
1819
return
1920
}
21+
// if no number is specified, destroy ALL THE UNITS!
22+
if num == 0 {
23+
num = len(units)
24+
}
2025
if strings.HasSuffix(component, "-data") {
2126
err = c.destroyDataUnit(component)
2227
} else {

0 commit comments

Comments
 (0)