Repository: fedora-infra/bodhi

Issue:
'bodhi overrides edit --expire' finishes with "Running koji wait-repo ..."
Running `bodhi overrides edit --expire ...` finishes with the output "Running koji wait-repo ...".
But then finishes anyway. This looks like erroneous output to me - while mostly harmless it is a bit confusing.

I am using bodhi-client-6.0.1-4.fc37 - here is an example:

```shellsession
$ bodhi overrides edit --expire rpmbuild-order-0.4.10-1.fc35
============================================================
     rpmbuild-order-0.4.10-1.fc35
============================================================
  Submitter: petersen
  Expiration Date: 2022-11-20 08:00:59
  Notes: No explanation given...
  Expired: True


Running koji wait-repo f35-build --build=rpmbuild-order-0.4.10-1.fc35
$ 
```
Since I didn't specify `--wait`, just finishing is fine, but the "Running koji..." message should not appear in this case I think?


Discussion:
Looks like `--wait` is the default:
https://github.com/fedora-infra/bodhi/blob/31c8358df9d893c7a0835a969094550438df3a5d/bodhi-client/bodhi/client/cli.py#L150-L161
After re-reading I now understand the confusion... we just have to change the default to `--no-wait` when `--expire` is passed as argument.

Resolving patch:
diff --git a/bodhi-client/bodhi/client/cli.py b/bodhi-client/bodhi/client/cli.py
--- a/bodhi-client/bodhi/client/cli.py
+++ b/bodhi-client/bodhi/client/cli.py
@@ -300,7 +300,9 @@ def _save_override(url: str, staging: bool, edit: bool = False,
                                 edit=edit,
                                 expired=kwargs.get('expire', False))
 
-    if kwargs['wait']:
+    if kwargs.get('expire', False):
+        print_resp(resp, client, override_hint=False)
+    elif kwargs['wait']:
         print_resp(resp, client, override_hint=False)
         command = _generate_wait_repo_command(resp, client)
         if command:


Test patch:
diff --git a/bodhi-client/tests/test_cli.py b/bodhi-client/tests/test_cli.py
--- a/bodhi-client/tests/test_cli.py
+++ b/bodhi-client/tests/test_cli.py
@@ -1979,13 +1979,14 @@ class TestEditBuildrootOverrides:
     Test the edit_buildroot_overrides() function.
     """
 
-    def test_expired_override(self, mocked_client_class):
+    def test_expire(self, mocked_client_class, mocker):
         """
         Assert that a successful overrides edit request expires the request
         when --expired flag is set.
         """
         mocked_client_class.send_request.return_value = \
             client_test_data.EXAMPLE_EXPIRED_OVERRIDE_MUNCH
+        call = mocker.patch('bodhi.client.cli.subprocess.call', return_value=0)
         runner = testing.CliRunner()
 
         result = runner.invoke(
@@ -1998,6 +1999,7 @@ def test_expired_override(self, mocked_client_class):
 
         assert result.exit_code == 0
         assert result.output == client_test_data.EXPECTED_EXPIRED_OVERRIDES_OUTPUT
+        call.assert_not_called()
         # datetime is a C extension that can't be mocked, so let's just assert that the time is
         # about a week away.
         expire_time = mocked_client_class.send_request.mock_calls[0][2]['data']['expiration_date']