-
Notifications
You must be signed in to change notification settings - Fork 302
fleetctl: print error when units were not found in registry #1503
Conversation
Hi @kayrus thank you for the patch! but since we agreed on ignoring non-existent units and don't fail we added unit tests for that case, and the patch just triggers those failures., and also findUnits() filters units based on what you have provided, if you did provided non-existent units, it will return an empty list and not an error. The callers assume an empty list if units do not exist, errors are only in case the Units() fail. |
6516506
to
39e0bfc
Compare
@tixxdz updated |
39e0bfc
to
ffe3981
Compare
ok thank you could you also please fix gofmt and push again ;-) While you are it why is this related to #1256 #710 ?? am I missing something here ? when you call with wildcards! I guess it's has nothing to do with fleetctl command or Go, it's you shell which expands automatically and by accident to local valid unit services..., you should know that you are doing or escape ?! are these really bugs related to fleet ? hmm ? |
ffe3981
to
b445699
Compare
Btw, should we filter units when we would like to print only one unit? I.e. $ systemctl list-unit-files etcd2.service
UNIT FILE STATE
etcd2.service disabled
1 unit files listed.
$ systemctl list-units etcd2.service
UNIT LOAD ACTIVE SUB DESCRIPTION
etcd2.service loaded active running etcd2
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'. $ fleetctl list-unit-files hello.service
UNIT HASH DSTATE STATE TARGET
hello.service 3750b3e launched launched 706e4d01.../coreos1
[email protected] 79699e3 launched launched 706e4d01.../coreos1
[email protected] 79699e3 launched launched 706e4d01.../coreos1
[email protected] 79699e3 launched launched 706e4d01.../coreos1
$ fleetctl list-units hello.service
UNIT MACHINE ACTIVE SUB
hello.service 706e4d01.../coreos1 active running
[email protected] 706e4d01.../coreos1 active running
[email protected] 706e4d01.../coreos1 active running
[email protected] 706e4d01.../coreos1 active running |
@kayrus hmm IMO yes it make sense, not sure what others think I guess the only thing to worry about is the exit codes, since list-unit-files always succeeded, this should not change. If unit tests are not there then this should also be added. |
I'm not convinced of this change: it seems a bit arbitrary to me that it warns if no units were matched, but not if some of the supplied units were matched while others were not. At the very least, the warning should be clearer, e.g. "Warning: No units matched." I'm not sure I understand the remark about listing one unit. (Isn't that a separate issue?...) |
14580b0
to
63b20dc
Compare
23d4b13
to
6fb1256
Compare
LGTM. |
fleetctl: print error when units were not found in registry
fleetctl: print error when units were not found in registry
fleetctl: print error when units were not found in registry
Destroy logic was already improved so this issue could be closed: #1256
#710
But we still have to print some kind of error message when units were not found.