Merge ~zioproto/ubuntu/+source/python-cinderclient:stable/newton into ~ubuntu-server-dev/ubuntu/+source/python-cinderclient:stable/newton

Proposed by Saverio Proto
Status: Needs review
Proposed branch: ~zioproto/ubuntu/+source/python-cinderclient:stable/newton
Merge into: ~ubuntu-server-dev/ubuntu/+source/python-cinderclient:stable/newton
Diff against target: 75 lines (+55/-0)
3 files modified
debian/changelog (+8/-0)
debian/patches/review-462204.patch (+46/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Corey Bryant Disapprove
Review via email: mp+326291@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Corey Bryant (corey.bryant) wrote :

-1 only because this particular merge proposal is for yakkety, which is EOL. I'm sponsoring this for xenial however. Thanks Saverio!

review: Disapprove

Unmerged commits

ae72775... by Saverio Proto <email address hidden>

Handle error response for webob>=1.6.0

* Handle error response for webob>=1.6.0
  - LP #1559072
  - d/p/review-462204.patch

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 36ec2e4..f803103 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+python-cinderclient (1:1.9.0-0ubuntu2) UNRELEASED; urgency=medium
7+
8+ * Handle error response for webob>=1.6.0
9+ - LP #1559072
10+ - d/p/review-462204.patch
11+
12+ -- Saverio Proto <saverio.proto@switch.ch> Mon, 26 Jun 2017 11:55:31 +0000
13+
14 python-cinderclient (1:1.9.0-0ubuntu1) yakkety; urgency=medium
15
16 * New upstream release.
17diff --git a/debian/patches/review-462204.patch b/debian/patches/review-462204.patch
18new file mode 100644
19index 0000000..22a3b08
20--- /dev/null
21+++ b/debian/patches/review-462204.patch
22@@ -0,0 +1,46 @@
23+commit b20d9fd6563c1ef295e8a260742f2b3e0b8ee327
24+Author: Akira KAMIO <akamio@yahoo-corp.jp>
25+Date: Tue Dec 6 14:10:38 2016 +0900
26+
27+ Handle error response for webob>=1.6.0
28+
29+ WebOb change https://github.com/Pylons/webob/pull/230 changed
30+ the way in which the error response body is formatted such that
31+ it's no longer a nested dict. So we have to handle both the
32+ old convention of an error message key to the response body error
33+ dict and the new way with just the error body dict.
34+
35+ This was reported upstream:
36+
37+ https://github.com/Pylons/webob/issues/235
38+
39+ But given this was apparently implemented as a long-overdue change
40+ in WebOb the behavior is not likely to change.Handle error response for
41+ webob>=1.6.0
42+
43+ Change-Id: I7d589415aa024588faf77c8234ac026110f6c3cd
44+ Closes-Bug: #1559072
45+ (cherry picked from commit 19befa69651a41534c7d25b1a0d3a0cd407afb44)
46+
47+diff --git a/cinderclient/exceptions.py b/cinderclient/exceptions.py
48+index 23b31b1..43ae5a4 100644
49+--- a/cinderclient/exceptions.py
50++++ b/cinderclient/exceptions.py
51+@@ -242,9 +242,14 @@ def from_response(response, body):
52+ message = "n/a"
53+ details = "n/a"
54+ if hasattr(body, 'keys'):
55+- error = body[list(body)[0]]
56+- message = error.get('message', message)
57+- details = error.get('details', details)
58++ # Only in webob>=1.6.0
59++ if 'message' in body:
60++ message = body.get('message')
61++ details = body.get('details')
62++ else:
63++ error = body[list(body)[0]]
64++ message = error.get('message', message)
65++ details = error.get('details', details)
66+ return cls(code=response.status_code, message=message, details=details,
67+ request_id=request_id, response=response)
68+ else:
69diff --git a/debian/patches/series b/debian/patches/series
70new file mode 100644
71index 0000000..62fd61c
72--- /dev/null
73+++ b/debian/patches/series
74@@ -0,0 +1 @@
75+review-462204.patch

Subscribers

People subscribed via source and target branches