diff --git a/fleetctl/destroy.go b/fleetctl/destroy.go index 0e6f1685a..46e16cb61 100644 --- a/fleetctl/destroy.go +++ b/fleetctl/destroy.go @@ -51,6 +51,11 @@ func runDestroyUnit(cCmd *cobra.Command, args []string) (exit int) { return 1 } + if len(units) == 0 { + stderr("Units not found in registry") + return 0 + } + for _, v := range units { err := cAPI.DestroyUnit(v.Name) if err != nil { diff --git a/fleetctl/stop.go b/fleetctl/stop.go index 2b03c51b6..7e770f5be 100644 --- a/fleetctl/stop.go +++ b/fleetctl/stop.go @@ -66,6 +66,11 @@ func runStopUnit(cCmd *cobra.Command, args []string) (exit int) { return 1 } + if len(units) == 0 { + stderr("Units not found in registry") + return 0 + } + stopping := make([]string, 0) for _, u := range units { if !suToGlobal(u) { diff --git a/fleetctl/unload.go b/fleetctl/unload.go index 238b89993..c7343f815 100644 --- a/fleetctl/unload.go +++ b/fleetctl/unload.go @@ -48,6 +48,11 @@ func runUnloadUnit(cCmd *cobra.Command, args []string) (exit int) { return 1 } + if len(units) == 0 { + stderr("Units not found in registry") + return 0 + } + wait := make([]string, 0) for _, s := range units { if !suToGlobal(s) {