Repository: fedora-infra/bodhi

Issue:
 Duplicate parameters for setting the state of request
[Lukas Slebodnik filed this issue in Bugzilla](https://bugzilla.redhat.com/show_bug.cgi?id=1408198):

> Description of problem:
> Acording to the help the state of package can be changed either by parameter --request and also as a last parameter.
>
> I didn't test but whether parameter --request is accepted or has higher priority then the last argument. But such situation is confusing.
> You should decide which way can be used. But there should be just one way.  
> 
> Version-Release number of selected component (if applicable):
> sh$ rpm -q bodhi-client 
> bodhi-client-2.3.3-1.fc26.noarch
> 
> How reproducible:
> Deterministic
> 
> Additional info:
> 1. bodhi updates request --help
> Usage: bodhi updates request [OPTIONS] UPDATE STATE
> 
> Options:
>   --user TEXT
>   --password TEXT
>   --request [testing|stable|unpush|obsolete|revoke]
>                                   Requested repository
>   --staging                       Use the staging bodhi instance
>   --help                          Show this message and exit.
> 
> man bodhi says:
>        bodhi updates request [options] <update> <state>
>           Request  that the given update be changed to the given state. update
>           should be given by update id, and state should be  one  of  testing,
>           stable, unpush, obsolete, or revoke.
>
>
> BTW, if you decide to use state from last parameter then IMHO it would be better to change or der of STATE and UPDATE. It will be simpler to implement bash completion for such order.


Discussion:
This could probably be considered a backwards incompatible change request. If we want to change it we will need to mark the option as deprecated and then wait until a major X release to drop the option.

This is all assuming the option actually works (I haven't tested it). If it doesn't work, we can just drop it.
It looks to me like the ```--request``` flag is ignored in the CLI:

```
122 @updates.command()
123 @click.argument('update')
124 @click.argument('state')
125 @click.option('--user', envvar='USERNAME')
126 @click.option('--password', prompt=True, hide_input=True)
127 @click.option('--request', help='Requested repository',
128               type=click.Choice(['testing', 'stable', 'unpush', 'obsolete', 'revoke']))
129 @click.option('--staging', help='Use the staging bodhi instance',
130               is_flag=True, default=False)
131 def request(update, state, user, password, **kwargs):
132     client = bindings.BodhiClient(username=user, password=password, staging=kwargs['staging'])
133 
134     try:
135         resp = client.request(update, state)
136     except bindings.UpdateNotFound as exc:
137         raise click.BadParameter(unicode(exc), param_hint='UPDATE')
138 
139     print_resp(resp, client)
```

Since it doesn't have any effect anyway, I think it is safe to drop the flag.

Resolving patch:
diff --git a/bodhi/client/__init__.py b/bodhi/client/__init__.py
--- a/bodhi/client/__init__.py
+++ b/bodhi/client/__init__.py
@@ -124,8 +124,6 @@ def query(**kwargs):
 @click.argument('state')
 @click.option('--user', envvar='USERNAME')
 @click.option('--password', prompt=True, hide_input=True)
-@click.option('--request', help='Requested repository',
-              type=click.Choice(['testing', 'stable', 'unpush', 'obsolete', 'revoke']))
 @click.option('--staging', help='Use the staging bodhi instance',
               is_flag=True, default=False)
 def request(update, state, user, password, **kwargs):


Test patch: