Bug 1574835
Summary: | units_cur broken (again) | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Martin Tarenskeen <m.tarenskeen> |
Component: | units | Assignee: | Kamil Dudka <kdudka> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | high | Docs Contact: | |
Priority: | unspecified | ||
Version: | 28 | CC: | jci.redhat, kdudka, m.tarenskeen |
Target Milestone: | --- | Keywords: | Reopened |
Target Release: | --- | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | units-2.16-5.fc29 units-2.14-6.fc27 units-2.16-5.fc28 units-2.18-1.fc28 units-2.18-1.fc29 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2018-11-09 05:25:19 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Martin Tarenskeen
2018-05-04 06:29:38 UTC
The error was not there the last time I tried the script. Something must have changed on the web service that units takes the data from. *** Bug 1576928 has been marked as a duplicate of this bug. *** units_cur makes the assumption that the json document returned from yahoo will contain a set of data for every resource element, for example:
{
"resource": {
"classname": "Quote",
"fields": {
"name": "USD/ECS",
"price": "25000.000000",
"symbol": "ECS=X",
"ts": "1487964442",
"type": "currency",
"utctime": "2017-02-24T19:27:22+0000",
"volume": "0"
}
}
}
Currently, yahoo is returning an empty resource:
{
"resource": {
"classname": "Quote",
"fields": {
}
}
},
This can be addressed by making units_cur slightly more robust by allowing for an exception when creating the currency exchange lists. I made this patch to units_cur (from units-2.16-4.fc28):
261,262c261,270
< rates = [ data['resource']['fields']['price'] for data in webdata]
< codes = [ data['resource']['fields']['symbol'][0:3] for data in webdata]
---
> rates = []
> codes = []
> for data in webdata:
> try:
> rate = data['resource']['fields']['price']
> code = data['resource']['fields']['symbol'][0:3]
> rates.append( rate )
> codes.append( code )
> except Exception:
> pass
This allows for skipping any values that cause an exception trying to grab the expected data.
Thanks! I have notified the upstream maintainer about the bug and proposed fix. I have picked the upstream fix for this: https://src.fedoraproject.org/cgit/rpms/units.git/commit/?id=8200b417 units-2.14-6.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-d787458160 units-2.16-5.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-8e52c5a761 units-2.14-6.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-d787458160 units-2.16-5.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-8e52c5a761 units-2.14-6.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report. units-2.16-5.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report. The problem (or a similar problem) has returned :-( Error connecting to currency server: 404 Client Error: Not Found for url: https://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote?format=json. I'm using units_cur from units-2.17-5.fc28.x86_64 now. (In reply to Martin Tarenskeen from comment #12) > Error connecting to currency server: > 404 Client Error: Not Found for url: > https://finance.yahoo.com/webservice/v1/symbols/allcurrencies/ > quote?format=json. Looks like Yahoo! does not provide the currency rate data on that URL any more. This bug has been fixed upstream in version 2.18 Indeed. Let's update to 2.18 to fix this! units-2.18-1.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-d28abe8ef5 units-2.18-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-5d8cba8f94 units-2.18-1.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-d28abe8ef5 units-2.18-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-5d8cba8f94 units-2.18-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report. units-2.18-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report. |