From b445699ecc204ddb1793ab5285a6e99980952f79 Mon Sep 17 00:00:00 2001 From: kayrus Date: Mon, 14 Mar 2016 11:26:08 +0100 Subject: [PATCH] fleetctl: print error message when units were not found in registry --- fleetctl/destroy.go | 5 +++++ fleetctl/stop.go | 5 +++++ fleetctl/unload.go | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/fleetctl/destroy.go b/fleetctl/destroy.go index 31eb919b6..c582423e8 100644 --- a/fleetctl/destroy.go +++ b/fleetctl/destroy.go @@ -46,6 +46,11 @@ func runDestroyUnits(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 7ffe26254..454fdc819 100644 --- a/fleetctl/stop.go +++ b/fleetctl/stop.go @@ -63,6 +63,11 @@ func runStopUnit(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 5bdbff3be..afd797b40 100644 --- a/fleetctl/unload.go +++ b/fleetctl/unload.go @@ -47,6 +47,11 @@ func runUnloadUnit(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) {