~oddbloke/cloud-init/fix-gce-az

« back to all changes in this revision

Viewing changes to cloudinit/cs_utils.py

  • Committer: Scott Moser
  • Date: 2015-07-16 13:15:05 UTC
  • mfrom: (1119.1.1 lp1475215)
  • Revision ID: smoser@ubuntu.com-20150716131505-pphdxhk7i078zcts
CloudSigma: encode/decode data before communicating over the serial channel

this fixes the cloudsigma datasource when used with python3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
        connection = serial.Serial(port=SERIAL_PORT,
84
84
                                   timeout=READ_TIMEOUT,
85
85
                                   writeTimeout=WRITE_TIMEOUT)
86
 
        connection.write(self.request)
87
 
        return connection.readline().strip('\x04\n')
 
86
        connection.write(self.request.encode('ascii'))
 
87
        return connection.readline().strip(b'\x04\n').decode('ascii')
88
88
 
89
89
    def _marshal(self, raw_result):
90
90
        try: