Py3.7 unit test failures

Bug #1785283 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-manilaclient
Fix Released
Undecided
Goutham Pacha Ravi
description: updated
Changed in python-manilaclient:
assignee: nobody → Goutham Pacha Ravi (gouthamr)
Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :
Download full text (4.2 KiB)

Interesting, in 3.7, urllib.parse's behavior changed [2] in-line with RFC 3986 [2], making these unit tests break in 3.7.

[1] https://tools.ietf.org/html/rfc3986.html
[2] https://docs.python.org/3/library/urllib.parse.html#url-quoting

Manila's url parsing accepts "~" as a safe character, see tests below. So, I think we can stop encoding the "~" character - however, "six.moves.parse.urlencode" in python2 is urllib.urlencode which doesn't allow specifying "safe" characters that it can ignore in the encoding.. So I suspect the fix will be ugly.

(overcloud) [stack@undercloud-0 ~]$ manila list --all-tenants
+--------------------------------------+------+------+-------------+-----------+-----------+-----------------+-----------------------------------+-------------------+----------------------------------+
| ID | Name | Size | Share Proto | Status | Is Public | Share Type Name | Host | Availability Zone | Project ID |
+--------------------------------------+------+------+-------------+-----------+-----------+-----------------+-----------------------------------+-------------------+----------------------------------+
| 0f706d5a-ffb6-4b18-9d14-3a14ad70db7b | test | 1 | NFS | available | False | default | hostgroup@tripleo_netapp#aggr1_n1 | nova | 03ec49a9757e4b539257d10e86f9feda |
+--------------------------------------+------+------+-------------+-----------+-----------+-----------------+-----------------------------------+-------------------+----------------------------------+

# Let's see if we get the same result with cURL:

(overcloud) [stack@undercloud-0 ~]$ curl -i -X GET http://10.0.0.101:8786/v2/03ec49a9757e4b539257d10e86f9feda/shares/detail?name~=test -H "X-Openstack-Manila-Api-Version: 2.42" -H "X-Auth-Token: gAAAAABbbeiM1ewUBQQDo51WGK43wG1WESUvyL_pbJxWAk6Trf2jHkwupM-W66a9LKfAtLEvDLktUMN6n0AKyhEOdPGlFq0OMMZfilP5kDlFDus7QLDxqgSLbn6B7N_JBjYmEHIWCnDa4yqctpo_pPOXEhPWZ_qNkJWVs6mevnwxgHOj3fHPGNQ" -H "Accept: application/json" -H "User-Agent: python-manilaclient"
HTTP/1.1 200 OK
X-Compute-Request-Id: req-5d09fef2-87ca-4759-a683-1df203f6c4fc
Content-Type: application/json
Content-Length: 1173
X-Openstack-Manila-Api-Version: 2.42
Vary: X-OpenStack-Manila-API-Version
Date: Fri, 10 Aug 2018 19:34:15 GMT

{"shares": [{"status": "available", "share_type_name": "default", "description": null, "links": [{"href": "http://10.0.0.101:8786/v2/03ec49a9757e4b539257d10e86f9feda/shares/0f706d5a-ffb6-4b18-9d14-3a14ad70db7b", "rel": "self"}, {"href": "http://10.0.0.101:8786/03ec49a9757e4b539257d10e86f9feda/shares/0f706d5a-ffb6-4b18-9d14-3a14ad70db7b", "rel": "bookmark"}], "availability_zone": "nova", "share_network_id": null, "share_server_id": null, "share_group_id": null, "host": "hostgroup@tripleo_netapp#aggr1_n1", "revert_to_snapshot_support": false, "access_rules_status": "active", "snapshot_id": null, "create_share_from_snapshot_support": true, "is_public": false, "task_state": null, "snapshot_support": true, "id": "0f706d5a-ffb6-4b18-9d14-3a14ad70db7b", "size": 1, "source_share_group_snapshot_member_id": null, "user_id": "b09f...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-manilaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/597181

Changed in python-manilaclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-manilaclient (master)

Reviewed: https://review.openstack.org/597181
Committed: https://git.openstack.org/cgit/openstack/python-manilaclient/commit/?id=80ec2919ca6dafe458c2db2e455f937e2f67cfe2
Submitter: Zuul
Branch: master

commit 80ec2919ca6dafe458c2db2e455f937e2f67cfe2
Author: Goutham Pacha Ravi <email address hidden>
Date: Mon Oct 8 15:09:39 2018 -0700

    Stop encoding "~" in query parameters

    IETF RFC 3986 classifies "~" as a reserved character [1],
    however until python3.7 [2], python's url parsing
    used to encode this character.

    urllib has seen a lot of churn in various python
    releases, and hence we were using a six wrapper
    to shield ourselves, however, this backwards-incompatible
    change in encoding norms forces us to deal with
    the problem at our end.

    Manila's API accepts "~" in both, its encoded
    or un-encoded forms. So, let's stop encoding it
    within manilaclient, regardless of the version
    of python running it.

    [1] https://tools.ietf.org/html/rfc3986.html
    [2] https://docs.python.org/3/library/urllib.parse.html#url-quoting

    Closes-Bug: #1785283
    Change-Id: I6df5d543ae94ed1fa966c8019a52e9fca19e387e

Changed in python-manilaclient:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-manilaclient 1.25.0

This issue was fixed in the openstack/python-manilaclient 1.25.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.