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

fleetctl: fleetctl status exits while checking batch of units with one unavailable unit #1497

Open
kayrus opened this issue Mar 11, 2016 · 4 comments

Comments

@kayrus
Copy link
Contributor

kayrus commented Mar 11, 2016

Steps to reproduce:

hello@.service:

[Service]
ExecStart=/bin/bash -c "while true; do echo Hello, World %i!; sleep 1; done"
fleetctl start hello@{2..10}.service
$ fleetctl status hello@{1..10}.service
Unit hello@1.service does not exist.
$ echo $?
1
@tixxdz
Copy link
Contributor

tixxdz commented Mar 11, 2016

Not sure I've to check again, but since I noticed that fleetctl status is a wrapper around systemctl status through ssh, it just executes the command and gets its exit status, so even if the command did execute successfully, the return code from systemctl status can be non-zero! so we just break and that's it.

systemctl status exit code are also not that standard since they may return same exit code for nonexistent units and stopped units. or even if the unit is not on the disk anymore... systemd/systemd#1092

If we can get the output first check some fields, then we may fallback to the exit code, and probably break from that loop only if the error is not related "systemctl status-of-unit", IOW break for all other errors even for systemctl ones...

@jonboulle
Copy link
Contributor

Hm what's the problem here? this seems like working as designed?

@kayrus
Copy link
Contributor Author

kayrus commented Mar 17, 2016

@jonboulle what if I want to print status for all units? current behavior will just stop fleetctl on first failed unit.

@jonboulle
Copy link
Contributor

Oh I see.

I dunno, this has been the behaviour forever. Should we really break it now? People needing granular information can always do a for loop around fleetctl status (which incidentally will perform basically the same since we moved to individual Unit() call(

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants