Merge lp:~fo0bar/turku/turku-agent-encoding into lp:turku/turku-agent

Proposed by Ryan Finnie
Status: Merged
Approved by: Haw Loeung
Approved revision: 52
Merged at revision: 53
Proposed branch: lp:~fo0bar/turku/turku-agent-encoding
Merge into: lp:turku/turku-agent
Diff against target: 28 lines (+4/-4)
1 file modified
turku_agent/ping.py (+4/-4)
To merge this branch: bzr merge lp:~fo0bar/turku/turku-agent-encoding
Reviewer Review Type Date Requested Status
Stuart Bishop (community) Approve
Review via email: mp+381075@code.launchpad.net

Commit message

Move encoding from writes to opens

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.

Revision history for this message
Stuart Bishop (stub) wrote :

Code changes look good. Looks like turku-agent has already switched to Python3, so no worries with Python2 compatibility.

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

Change successfully merged at revision 53

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'turku_agent/ping.py'
--- turku_agent/ping.py 2019-04-22 01:39:55 +0000
+++ turku_agent/ping.py 2020-03-23 22:52:07 +0000
@@ -40,9 +40,9 @@
4040
41def call_ssh(config, storage, ssh_req):41def call_ssh(config, storage, ssh_req):
42 # Write the server host public key42 # Write the server host public key
43 t = tempfile.NamedTemporaryFile()43 t = tempfile.NamedTemporaryFile(mode='w+', encoding='UTF-8')
44 for key in storage['ssh_ping_host_keys']:44 for key in storage['ssh_ping_host_keys']:
45 t.write(('%s %s\n' % (storage['ssh_ping_host'], key)).encode('UTF-8'))45 t.write('%s %s\n' % (storage['ssh_ping_host'], key))
46 t.flush()46 t.flush()
4747
48 # Call ssh48 # Call ssh
@@ -60,10 +60,10 @@
60 storage['ssh_ping_host'],60 storage['ssh_ping_host'],
61 'turku-ping-remote',61 'turku-ping-remote',
62 ]62 ]
63 p = subprocess.Popen(ssh_command, stdin=subprocess.PIPE)63 p = subprocess.Popen(ssh_command, stdin=subprocess.PIPE, encoding='UTF-8')
6464
65 # Write the ssh request65 # Write the ssh request
66 p.stdin.write((json.dumps(ssh_req) + '\n.\n').encode('UTF-8'))66 p.stdin.write(json.dumps(ssh_req) + '\n.\n')
67 p.stdin.flush()67 p.stdin.flush()
6868
69 # Wait for the server to close the SSH connection69 # Wait for the server to close the SSH connection

Subscribers

People subscribed via source and target branches

to all changes: