diff options
author | Scott Moser <smoser@ubuntu.com> | 2014-07-21 14:33:27 -0400 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2014-07-21 14:33:27 -0400 |
commit | 0dbd2a0ec71de2f9d8d631ae5241a948fc6a51ee (patch) | |
tree | 658d3a3d0e2675a1738d65cc1260f2594877c360 /cloudinit/cs_utils.py | |
parent | f9d18e2ed747a6d44e60547fbcc0bbff780f351f (diff) | |
parent | 6a4976e8a9915680fbc91f90bed8fcfa79cba5cf (diff) | |
download | vyos-cloud-init-0dbd2a0ec71de2f9d8d631ae5241a948fc6a51ee.tar.gz vyos-cloud-init-0dbd2a0ec71de2f9d8d631ae5241a948fc6a51ee.zip |
merge from trunk
Diffstat (limited to 'cloudinit/cs_utils.py')
-rw-r--r-- | cloudinit/cs_utils.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/cloudinit/cs_utils.py b/cloudinit/cs_utils.py index 4e53c31a..dcf56431 100644 --- a/cloudinit/cs_utils.py +++ b/cloudinit/cs_utils.py @@ -35,6 +35,10 @@ import platform import serial +# these high timeouts are necessary as read may read a lot of data. +READ_TIMEOUT = 60 +WRITE_TIMEOUT = 10 + SERIAL_PORT = '/dev/ttyS1' if platform.system() == 'Windows': SERIAL_PORT = 'COM2' @@ -76,7 +80,9 @@ class CepkoResult(object): self.result = self._marshal(self.raw_result) def _execute(self): - connection = serial.Serial(SERIAL_PORT) + connection = serial.Serial(port=SERIAL_PORT, + timeout=READ_TIMEOUT, + writeTimeout=WRITE_TIMEOUT) connection.write(self.request) return connection.readline().strip('\x04\n') |