New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4.0 rc3 qvm-check's output and retcode kind of buggy #3496

Open
taradiddles opened this Issue Jan 26, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@taradiddles

Qubes OS version:

R4.0 rc3


Steps to reproduce the behavior:

I'm scripting some stuff in dom0 and need to check if a VM exists ; qvm-check seems to be the way to go rather than grepping the output of qvm-ls.

Let's assume that a VM named "work" exists and that a VM named "work1" doesn't.

Case 1: checking if VM "work" is running: works as expected

[user@dom0 ~]$ qvm-check work
VM work exists
[user@dom0 ~]$ echo $?
0

Case 2: adding the --quiet arg: the output isn't suppressed

[user@dom0 ~]$ qvm-check --quiet work
VM work exists

Case 3: finding out what the retcode for a wrong syntax is (to compare with case 4 below)

[user@dom0 ~]$ qvm-check --blahblah
[...]
[user@dom0 ~]$ echo $?
2

Case 4: checking if a non existent VM exists: usage() is displayed and usage()'s retcode is returned despite the syntax being right; one would expect the retcode "1"

[user@dom0 ~]$ qvm-check work1
usage: qvm-check [-h] [--verbose] [--quiet] [--all] [--exclude EXCLUDE]
                 [--running] [--paused] [--template]
                 [VMNAME [VMNAME ...]]
qvm-check: error: no such domain: 'work1'
[user@dom0 ~]$ echo $?
2

I looked at /usr/lib/python3.5/site-packages/qubesadmin/tests/tools/qvm_check.py to try to fix it and send a PR, but it was a bit too cryptic for me.

Very minor issue BTW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment