Merge lp:~hopem/maas-deployer/lp1577910 into lp:~maas-deployers/maas-deployer/next

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 74
Proposed branch: lp:~hopem/maas-deployer/lp1577910
Merge into: lp:~maas-deployers/maas-deployer/next
Diff against target: 25 lines (+5/-3)
1 file modified
maas_deployer/vmaas/maasclient/bootimages.py (+5/-3)
To merge this branch: bzr merge lp:~hopem/maas-deployer/lp1577910
Reviewer Review Type Date Requested Status
Billy Olsen Approve
Review via email: mp+294263@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Billy Olsen (billy-olsen) wrote :

LGTM, Approved.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maas_deployer/vmaas/maasclient/bootimages.py'
2--- maas_deployer/vmaas/maasclient/bootimages.py 2015-12-10 05:47:47 +0000
3+++ maas_deployer/vmaas/maasclient/bootimages.py 2016-05-10 15:54:54 +0000
4@@ -37,16 +37,18 @@
5 url = 'http://%(host)s/MAAS' % {'host': self.host}
6 response, _ = self.http.request(url, 'GET')
7 self.headers['Content-type'] = 'application/x-www-form-urlencoded'
8- self.headers['Cookie'] = response['set-cookie']
9
10- csrf_token = self.headers['Cookie'].split(';')[0].split('=')[1]
11 body = {
12 'username': self.username,
13 'password': self.password,
14 'next': '/MAAS/images',
15- 'csrfmiddlewaretoken': csrf_token
16 }
17
18+ if 'set-cookie' in response:
19+ self.headers['Cookie'] = response['set-cookie']
20+ csrf_token = self.headers['Cookie'].split(';')[0].split('=')[1]
21+ body['csrfmiddlewaretoken'] = csrf_token
22+
23 url = 'http://%(host)s/MAAS/accounts/login/' % {'host': self.host}
24 response, _ = self.http.request(url, 'POST', headers=self.headers,
25 body=urllib.urlencode(body))

Subscribers

People subscribed via source and target branches