Bug 1268811 - bkr system-modify succeeds without fqdn
Summary: bkr system-modify succeeds without fqdn
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Beaker
Classification: Retired
Component: command line
Version: 21
Hardware: All
OS: Linux
medium
medium
Target Milestone: 23.0
Assignee: Blake McIvor
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-05 10:56 UTC by Jiri Jaburek
Modified: 2016-07-07 23:12 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-07 23:12:35 UTC
Embargoed:


Attachments (Terms of Use)

Description Jiri Jaburek 2015-10-05 10:56:03 UTC
Description of problem:

Out of these 3 cases, the middle one is, I believe, incorrect, since system-modify --help clearly specifies the <fqdn> as mandatory:


$ bkr system-modify ; echo $?
Usage: bkr system-modify [options] <fqdn> ..

bkr: error: At least one option is required, specifying what to change
2

$ bkr system-modify --condition=Broken ; echo $?
0

$ bkr system-modify --condition=Broken non-existent-fqdn ; echo $?
HTTP error: 404 Client Error: NOT FOUND
System not found
1


Version-Release number of selected component (if applicable):
beaker-client-21.0-1.fc22.noarch

How reproducible:
always

Actual results:
bkr system-modify returns 0 when no action was performed

Expected results:
bkr system-modify returns non-0 when given no fqdn, ie. like system-power;
$ bkr system-power --action=on ; echo $?
Usage: bkr system-power [options] <fqdn>

bkr: error: Exactly one system fqdn must be given
2

Comment 1 Blake McIvor 2016-04-26 06:07:39 UTC
https://gerrit.beaker-project.org/#/c/4829/

Comment 2 Dan Callaghan 2016-04-28 00:49:13 UTC
(In reply to Jiri Jaburek from comment #0)
> Expected results:
> bkr system-modify returns non-0 when given no fqdn, ie. like system-power;
> $ bkr system-power --action=on ; echo $?
> Usage: bkr system-power [options] <fqdn>
> 
> bkr: error: Exactly one system fqdn must be given
> 2

To be clear, we won't make bkr system-modify accept exactly one FQDN, even though some of the other client commands do that. Right now it accepts multiple FQDNs and changing that would break people's scripts (for no good reason).

So the expected result here is more like:

$ bkr system-modify
bkr: error: Specify one or more system FQDNs to modify

with a non-zero exit status.

Comment 3 Jiri Jaburek 2016-04-28 14:15:06 UTC
I based my expected result on the manpage, which says

       bkr system-modify [options] <fqdn> ..

for >= 0 fqdns, I'd expect:

       bkr system-modify [options] [fqdn]...

(like most GNU commands have)

Making it accept one or more is also a viable alternative.

Comment 4 Dan Callaghan 2016-04-29 00:01:27 UTC
Mainly I was writing to clarify because Blake was not sure if we should accept exactly one fqdn, or one or more fqdns. It has to be the latter for compatibility.

For one or more fqdns I think the help we have now is correct, right?

Comment 5 Jiri Jaburek 2016-05-02 13:12:22 UTC
(In reply to Dan Callaghan from comment #4)
> Mainly I was writing to clarify because Blake was not sure if we should
> accept exactly one fqdn, or one or more fqdns. It has to be the latter for
> compatibility.
> 
> For one or more fqdns I think the help we have now is correct, right?

I think so.

The more traditional (GNU) way is to use 3 dots without a space, like

    <fqdn>...
or
    FQDN...

with some tools using ie.

    <fqdn> [fqdn]...

but anything reasonable works, I guess.

Comment 7 Roman Joost 2016-05-16 00:39:00 UTC
The client to be used to test this bug should be beaker-client-23.0-0.git.212.a10d3a6

Comment 8 Roman Joost 2016-05-16 00:47:20 UTC
For reference, the repositories providing nightlies can be found under:

https://beaker-project.org/nightlies/develop/

Comment 10 Dan Callaghan 2016-07-07 23:12:35 UTC
Beaker 23.0 has been released.


Note You need to log in before you can comment on or make changes to this bug.