This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1268811 - bkr system-modify succeeds without fqdn
bkr system-modify succeeds without fqdn
Status: CLOSED CURRENTRELEASE
Product: Beaker
Classification: Community
Component: command line (Show other bugs)
21
All Linux
medium Severity medium (vote)
: 23.0
: ---
Assigned To: Blake McIvor
tools-bugs
: EasyFix, Patch, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-05 06:56 EDT by Jiri Jaburek
Modified: 2016-07-07 19:12 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-07 19:12:35 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jiri Jaburek 2015-10-05 06:56:03 EDT
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 02:07:39 EDT
https://gerrit.beaker-project.org/#/c/4829/
Comment 2 Dan Callaghan 2016-04-27 20:49:13 EDT
(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 10:15:06 EDT
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-28 20:01:27 EDT
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 09:12:22 EDT
(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-15 20:39:00 EDT
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-15 20:47:20 EDT
For reference, the repositories providing nightlies can be found under:

https://beaker-project.org/nightlies/develop/
Comment 10 Dan Callaghan 2016-07-07 19:12:35 EDT
Beaker 23.0 has been released.

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