#160 Setting CORS or support JSONP on waiverdb
Closed 6 years ago Opened 6 years ago by pingou.

I'm looking at displaying in a bodhi update if it was waived and I'm seeing waiverdb in Fedora does not set a CORS header nor seems to support JSONP.

Could we get either solution implemented?


Hm, apparently, the code supports CORS, so it may just be a config issue

JSONP is actually supported.

For CORS there is some code for it but it's not being used anywhere but in the error page :(

Hold the phone. Bodhi can get all the waivers from greenwave if Bodhi passes verbose=True in its query to Greenwave. It can also get the raw results this way.

  • It should do this so that we stop all those browsers from querying resultsdb, which is likely causing load issues there.
  • It could also do this for waivers, to show them.

How's that sound? (I'm not opposed to fixing CORS support).

Oh, getting this from greenwave sounds very good to me, cool! :)

Hm actually, will greenwave ask waiverdb if there is a waiver or does it cache the information?

So if I waive an update, how long will it take before greenwave knows about it and return the info to bodhi that is querying it?

Also, would you have an example, I'm seeing this waiver: https://waiverdb-web-waiverdb.app.os.fedoraproject.org/api/v1.0/waivers/100

but if I ask greenwave for: {'product_version': 'fedora-27', 'verbose': True, 'decision_context': 'bodhi_update_push_testing', 'subject': [{'item': 'python37-3.7.0-0.14.b3.fc27', 'type': 'koji_build'}]} I'm not seeing any waivers listed. Is this expected?

@pingou are you sure? Were you using 'fedora-26' or 'fedora-27' for the production version? The waiver is against 'fedora-27'. When I try this:

$ curl -H Content-Type:application/json --data '{"product_version": "fedora-27", "verbose": true, "decision_context": "bodhi_update_push_testing", "subject": [{"item": "python37-3.7.0-0.14.b3.fc27", "type": "koji_build"}]}' https://greenwave-web-greenwave.app.os.fedoraproject.org/api/v1.0/decision

it comes back with waiver 100 in the response.

To answer your earlier question, Greenwave does cache Waivers but it has a fedmsg consumer which is supposed to invalidate the cache as soon as a new waiver appears. So Greenwave should take into account the new waiver "straight away", give or take some delay for the fedmsg to make it through.

@pingou are you sure? Were you using 'fedora-26' or 'fedora-27' for the production version? The waiver is against 'fedora-27'.

Ok I see it now, stg vs prod... :)

OK, since jsonp is in place I'm going to close this one.

Metadata Update from @ralph:
- Issue status updated to: Closed (was: Open)

6 years ago

I guess JSONP has the downside that you can only do GET requests and are thus subject to query string length limits, though...

I'd still consider fixing CORS indeed, especially since the code is there, it's just not used :]

I may try to submit a PR for this

Login to comment on this ticket.

Metadata