Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit a1a21b8

Browse files
author
Dongsu Park
committed
Merge pull request #1503 from endocode/kayrus/units_not_found
fleetctl: print error when units were not found in registry
2 parents 40a90d0 + b445699 commit a1a21b8

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

fleetctl/destroy.go

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ func runDestroyUnit(cCmd *cobra.Command, args []string) (exit int) {
5151
return 1
5252
}
5353

54+
if len(units) == 0 {
55+
stderr("Units not found in registry")
56+
return 0
57+
}
58+
5459
for _, v := range units {
5560
err := cAPI.DestroyUnit(v.Name)
5661
if err != nil {

fleetctl/stop.go

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ func runStopUnit(cCmd *cobra.Command, args []string) (exit int) {
6666
return 1
6767
}
6868

69+
if len(units) == 0 {
70+
stderr("Units not found in registry")
71+
return 0
72+
}
73+
6974
stopping := make([]string, 0)
7075
for _, u := range units {
7176
if !suToGlobal(u) {

fleetctl/unload.go

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ func runUnloadUnit(cCmd *cobra.Command, args []string) (exit int) {
4848
return 1
4949
}
5050

51+
if len(units) == 0 {
52+
stderr("Units not found in registry")
53+
return 0
54+
}
55+
5156
wait := make([]string, 0)
5257
for _, s := range units {
5358
if !suToGlobal(s) {

0 commit comments

Comments
 (0)