From 35c7d4393c0b9f898be2137a8cbbfa317c048df9 Mon Sep 17 00:00:00 2001 From: Djalal Harouni Date: Wed, 17 Feb 2016 10:04:10 +0100 Subject: [PATCH] fleetctl:destroy: on destroy check if the unit does exist or not Do not error out directly if Destroy command fails, check first if the unit does really exist if no then ignore the destroy error and continue. Follow-up fix for: https://github.com/coreos/fleet/issues/1383 --- fleetctl/destroy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fleetctl/destroy.go b/fleetctl/destroy.go index 54c6a57b8..5e0aea5bf 100644 --- a/fleetctl/destroy.go +++ b/fleetctl/destroy.go @@ -42,6 +42,11 @@ func runDestroyUnits(args []string) (exit int) { for _, v := range units { err := cAPI.DestroyUnit(v.Name) if err != nil { + // If unit does not exist do not error out + u, _ := cAPI.Unit(v.Name) + if u == nil { + continue + } stderr("Error destroying units: %v", err) exit = 1 continue