#317 Make fedpkg update output a report after success
Merged 5 years ago by onosek. Opened 5 years ago by eclipseo.

file modified
+5 -1
@@ -280,7 +280,11 @@

                  raise ValueError(

                      'Incorrect request type {0}'.format(detail['request']))

  

-             bodhi.save(**detail)

+             try:

+                 self.log.info(bodhi.update_str(bodhi.save(**detail), minimal=False))

+             # Only because tests do not return a valid bodhi.save value

+             except TypeError:

+                 pass

  

      def create_buildroot_override(self, bodhi_config, build, duration,

                                    notes=''):

Fixes #315

Signed-off-by: Robert-André Mauchin zebob.m@gmail.com

Remove munch? It is not used in this patch.

The resp variable contains munch data, It fails to pass the data to bodhi.update_str if munch is not imported. (munch is already a deps of bodhi bindings).

For the failed build I think maybe the data returned by save is not conform during the test, hence it fail in update_str. Would it be ok to use a try: except: to bypass that error?

rebased onto 7a1de775279a3c43d00e07574526a526892e4330

5 years ago

rebased onto 5646753c4d0c19006802c0c8fde2b2d2ce977ad4

5 years ago

Hi @eclipseo,

I haven't found what returns bodhi.save in documentation:
https://bodhi.readthedocs.io/en/latest/python_bindings.html#bodhi.client.bindings.BodhiClient.save
but let's say it returns the data. But I definitely prefer try&except approach to handle this. Making munch another dependency of fedpkg doesn't mean minor efford.

Thank you.

Try this link: https://bodhi.fedoraproject.org/docs/python_bindings.html#bodhi.client.bindings.BodhiClient.save

It says:
Returns: The Bodhi server’s response to the request.
Return type: munch.Munch

I don't see adding munch as an issue as it is already a dependency of the Bodhi Python bindings, which we use.

Thank you for the documentation link, it is OK.

Technically yes, I do not have to necessarily add munch to fedpkg specfile as it is indirectly installed. But I would like to have all used imports directly mentioned there. At least to know what fedpkg depends on.

I also think that try&except structure is more straightforward and it can additionally cover unexcepted exceptions and not just unequal returned type.

rebased onto 7c1ca0ef06501ca8e84cc00546940a6ea7b8ce84

5 years ago

How about now?

I now pass the bodhi.save(**detail) call directly to bodhi.update_str, so munch is not needed.

I added a try/except for the test failure.

rebased onto 06cd437

5 years ago

This change looks good. I will merge it.

Pull-Request has been merged by onosek

5 years ago