summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2015-07-16 09:15:05 -0400
committerScott Moser <smoser@ubuntu.com>2015-07-16 09:15:05 -0400
commit22186f7efb9437b3b4d0fcd82319e2392bc8b4ac (patch)
tree44e45190b83194c718f68c6ebd96061b6801acb2
parent8711d6ab60f25ee8604fd777c749ef3f90c4bd7f (diff)
parentc33ac7e2deecadeb7f34dacc4e91a3cad2c87ffd (diff)
downloadvyos-cloud-init-22186f7efb9437b3b4d0fcd82319e2392bc8b4ac.tar.gz
vyos-cloud-init-22186f7efb9437b3b4d0fcd82319e2392bc8b4ac.zip
CloudSigma: encode/decode data before communicating over the serial channel
this fixes the cloudsigma datasource when used with python3. LP: #1475215
-rw-r--r--cloudinit/cs_utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/cs_utils.py b/cloudinit/cs_utils.py
index dcf56431..83ac1a0e 100644
--- a/cloudinit/cs_utils.py
+++ b/cloudinit/cs_utils.py
@@ -83,8 +83,8 @@ class CepkoResult(object):
connection = serial.Serial(port=SERIAL_PORT,
timeout=READ_TIMEOUT,
writeTimeout=WRITE_TIMEOUT)
- connection.write(self.request)
- return connection.readline().strip('\x04\n')
+ connection.write(self.request.encode('ascii'))
+ return connection.readline().strip(b'\x04\n').decode('ascii')
def _marshal(self, raw_result):
try: