Merge lp:~lamont/maas/bug-1494971-1.7 into lp:maas/1.7

Proposed by LaMont Jones
Status: Merged
Approved by: LaMont Jones
Approved revision: no longer in the source branch.
Merged at revision: 3382
Proposed branch: lp:~lamont/maas/bug-1494971-1.7
Merge into: lp:maas/1.7
Diff against target: 40 lines (+14/-2)
1 file modified
src/provisioningserver/rpc/clusterservice.py (+14/-2)
To merge this branch: bzr merge lp:~lamont/maas/bug-1494971-1.7
Reviewer Review Type Date Requested Status
Mike Pontillo (community) Approve
Review via email: mp+274336@code.launchpad.net

Commit message

Update to work with twisted 15

To post a comment you must log in.
Revision history for this message
LaMont Jones (lamont) wrote :

backport fix from 1.8 to 1.7

Revision history for this message
Mike Pontillo (mpontillo) wrote :

Thanks for the fix.

Just one question: can you link the branch rather than hard-coding the [bug=] and [author=] info that the lander would otherwise populate? (or was there a reason you did that?)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/rpc/clusterservice.py'
2--- src/provisioningserver/rpc/clusterservice.py 2015-08-03 18:29:28 +0000
3+++ src/provisioningserver/rpc/clusterservice.py 2015-10-13 23:28:31 +0000
4@@ -105,6 +105,15 @@
5 from twisted.web.client import getPage
6 from zope.interface import implementer
7
8+# XXX lamont 2015-10-13 LP:1504971 aka 1372767 revisited aka 1505748.
9+# Twisted 15+ changes the name of web.client._URI class to web.client.URI.
10+# Once we can require a new enough twisted to have the fix for 1505748, we
11+# can drop the entire patch to twisted.
12+try:
13+ from twisted.web.client import _URI as URI
14+except ImportError:
15+ from twisted.web.client import URI
16+
17
18 maaslog = get_maas_logger("rpc.cluster")
19
20@@ -601,7 +610,7 @@
21 log.msg("Peer certificate: %r" % self.peerCertificate)
22
23
24-class PatchedURI(twisted.web.client._URI):
25+class PatchedURI(URI):
26
27 @classmethod
28 def fromBytes(cls, uri, defaultPort=None):
29@@ -676,7 +685,10 @@
30 # URL with an IPv6 address, at the point where `_makeGetterFactory`
31 # calls `fromBytes`. That last function assumes that a colon can only
32 # occur in the URL's netloc portion as part of a port specification.
33- twisted.web.client._URI = PatchedURI
34+ if hasattr(twisted.web.client, "_URI"):
35+ twisted.web.client._URI = PatchedURI
36+ else:
37+ twisted.web.client.URI = PatchedURI
38
39 def startService(self):
40 self.time_started = self.clock.seconds()

Subscribers

People subscribed via source and target branches

to all changes: