diff options
-rw-r--r-- | cloudinit/cs_utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cloudinit/cs_utils.py b/cloudinit/cs_utils.py index 4e53c31a..1db3f110 100644 --- a/cloudinit/cs_utils.py +++ b/cloudinit/cs_utils.py @@ -35,6 +35,8 @@ import platform import serial +READ_TIMEOUT = 60 +WRITE_TIMEOUT = 10 SERIAL_PORT = '/dev/ttyS1' if platform.system() == 'Windows': SERIAL_PORT = 'COM2' @@ -76,7 +78,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') |