Merge lp:~mthaddon/charm-haproxy/self-signed-write into lp:charm-haproxy

Proposed by Tom Haddon
Status: Merged
Approved by: Fabian Bertetto
Approved revision: 161
Merged at revision: 160
Proposed branch: lp:~mthaddon/charm-haproxy/self-signed-write
Merge into: lp:charm-haproxy
Diff against target: 33 lines (+3/-2)
2 files modified
charmcraft.yaml (+1/-0)
hooks/hooks.py (+2/-2)
To merge this branch: bzr merge lp:~mthaddon/charm-haproxy/self-signed-write
Reviewer Review Type Date Requested Status
Canonical IS Reviewers Pending
haproxy-team Pending
Review via email: mp+448351@code.launchpad.net

Commit message

Fix writing self-signed cert for python3

Description of the change

Fix writing self-signed cert for python3

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

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

161. By Tom Haddon

Include data directory so self-signed cert can be created, and encode ssl_cert when reading it

Revision history for this message
Fabian Bertetto (fbertetto) wrote :

LGTM

Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 160

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmcraft.yaml'
2--- charmcraft.yaml 2023-07-13 09:58:25 +0000
3+++ charmcraft.yaml 2023-08-03 10:46:15 +0000
4@@ -20,6 +20,7 @@
5 stage:
6 - '*'
7 prime:
8+ - data
9 - files
10 - hooks
11 - templates
12
13=== modified file 'hooks/hooks.py'
14--- hooks/hooks.py 2023-08-02 10:03:05 +0000
15+++ hooks/hooks.py 2023-08-03 10:46:15 +0000
16@@ -845,7 +845,7 @@
17 full_path = os.path.join(path, "%d.pem" % i)
18 write_ssl_pem(full_path, content)
19 with open(full_path, 'w') as f:
20- f.write(content)
21+ f.write(content.decode('utf-8'))
22
23 if not os.path.exists(default_haproxy_service_config_dir):
24 os.mkdir(default_haproxy_service_config_dir, 0o600)
25@@ -1099,7 +1099,7 @@
26 config_data = config_get()
27 ssl_cert = config_data.get("ssl_cert")
28 if ssl_cert == "SELFSIGNED":
29- ssl_cert = base64.b64encode(get_selfsigned_cert()[0])
30+ ssl_cert = base64.b64encode(get_selfsigned_cert()[0].encode('utf-8'))
31 relation_settings = {
32 "public-address": unit_get("public-address"),
33 "ssl_cert": ssl_cert,

Subscribers

People subscribed via source and target branches

to all changes: