summaryrefslogtreecommitdiff
path: root/cloudinit/cs_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/cs_utils.py')
-rw-r--r--cloudinit/cs_utils.py8
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')