Merge lp:~mthaddon/juju-deployer/lp-1892423 into lp:juju-deployer

Proposed by Tom Haddon
Status: Merged
Approved by: Tom Haddon
Approved revision: 223
Merged at revision: 223
Proposed branch: lp:~mthaddon/juju-deployer/lp-1892423
Merge into: lp:juju-deployer
Diff against target: 53 lines (+13/-5)
3 files modified
deployer/deployment.py (+5/-2)
deployer/tests/test_data/blog.snippet (+2/-1)
deployer/tests/test_deployment.py (+6/-2)
To merge this branch: bzr merge lp:~mthaddon/juju-deployer/lp-1892423
Reviewer Review Type Date Requested Status
Benjamin Allot Approve
Canonical IS Reviewers Pending
Review via email: mp+408802@code.launchpad.net

Commit message

Update diff to deal correctly with include files lp#1892423

To post a comment you must log in.
Revision history for this message
Tom Haddon (mthaddon) wrote :

To confirm the functionality of this branch (in addition to running tests) I've tested with apache2:

https://pastebin.ubuntu.com/p/2SP5mTjrYM/

Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Benjamin Allot (ballot) wrote :

LGTM

review: Approve
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

Change successfully merged at revision 223

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'deployer/deployment.py'
2--- deployer/deployment.py 2020-10-16 07:29:31 +0000
3+++ deployer/deployment.py 2021-09-17 13:14:57 +0000
4@@ -5,6 +5,7 @@
5 import logging
6 import pprint
7 import os
8+import textwrap
9 import yaml
10
11 import six
12@@ -268,8 +269,10 @@
13 with open(ip, 'rb') as fh:
14 v = fh.read()
15 if include_type == "base64":
16- v = b64encode(v)
17- return v
18+ # Follow Juju's approach of wrapping at 76 characters.
19+ return "\n".join(textwrap.wrap(b64encode(v).decode(), 76))
20+ else:
21+ return v.strip().decode()
22 if feedback:
23 return feedback
24
25
26=== modified file 'deployer/tests/test_data/blog.snippet'
27--- deployer/tests/test_data/blog.snippet 2013-07-22 15:29:31 +0000
28+++ deployer/tests/test_data/blog.snippet 2021-09-17 13:14:57 +0000
29@@ -1,1 +1,2 @@
30-HelloWorld
31\ No newline at end of file
32+This content needs to be long enough to require it to be wrapped onto two
33+lines when we convert it to base64.
34
35=== modified file 'deployer/tests/test_deployment.py'
36--- deployer/tests/test_deployment.py 2016-10-31 14:12:44 +0000
37+++ deployer/tests/test_deployment.py 2021-09-17 13:14:57 +0000
38@@ -67,9 +67,13 @@
39 self.assertEqual(d.get_service('newrelic').config, {'key': 'abc'})
40 self.assertEqual(
41 base64.b64decode(d.get_service('blog').config['wp-content']),
42- b"HelloWorld")
43+ b"This content needs to be long enough to require it to be wrapped onto two\n"
44+ b"lines when we convert it to base64.\n")
45
46- # TODO verify include-file
47+ # Verify include-file (we'll just verify the first part of it)
48+ self.assertEqual(
49+ d.get_service('haproxy').config['services'][:20],
50+ '- service_name: blog')
51
52 # Verify relations
53 self.assertEqual(

Subscribers

People subscribed via source and target branches