red-hat-storage / errata-tool

Modern Python API to Red Hat's Errata Tool
MIT License
31 stars 35 forks source link

Quietly failing to update owner_email and manager_email #208

Closed jimbair closed 3 years ago

jimbair commented 3 years ago

I am working on some code to check if an erratum is owned by a service account, and if so, try to assign it to the developer who owns the package. The snippet in question:

            erratum.update(owner_email=owner_email, manager_email=manager_email)
            erratum.commit()

The commit() method runs without failure or error, however, the update doesn't occur. The inputs are the same that we are using during erratum creation, so those should be okay. Also, the failure seems to be the same whether it's me trying to from user (which should fail/throw an exception) or if it's the service account that should have the ability to make the update.

I'm not sure if I'm doing something silly, or if there's a bug that stops the commit/update from happening. I was going to split this into two updates to see if it helped (and possibly two commits) but figured I would ask for some eyes before I got down that rabbit hole.

jimbair commented 3 years ago

I'll take a look this week and see if I can find anything and update this thread; I'm operating under the assumption it's operator error.

ktdreyer commented 3 years ago

Thanks. I'm trying to duplicate this one here as well.

jimbair commented 3 years ago

Thanks. I'm trying to duplicate this one here as well.

I PM'd you my test case on internal chat =)

ktdreyer commented 3 years ago

Thanks. I'm still working to reproduce this locally.

ktdreyer commented 3 years ago

I stepped through the HTTP requests. The problem is that python-errata-tool fails to send those advisory[package_owner_email] or advisory[manager_email] parameters with the PUT request to update existing advisories.

https://github.com/red-hat-storage/errata-tool/pull/212 fixes it in my testing. @jimbair are you able to test it out?

ktdreyer commented 3 years ago

(I made a tangential discovery while looking at the HTTP requests in Wireshark: the way that we're sending form data with POST and PUT to /api/v1/erratum does not appear to be documented in the ET REST API docs. The ET team has documented that users should send a JSON body instead. I wonder if our use of that endpoint pre-dates that JSON body guidance. Either way, it still works, whether due to Rails magic or something else.)