Commit 35841794 authored by Nikos Skalkotos's avatar Nikos Skalkotos

Fix a 'FileNotFoundError' is not defined error

This exception does not exist in python 2.x
parent bd3103bc
...@@ -23,6 +23,7 @@ import signal ...@@ -23,6 +23,7 @@ import signal
import tempfile import tempfile
import os import os
import time import time
import errno
from string import lowercase, uppercase, digits from string import lowercase, uppercase, digits
from image_creator.util import FatalError, get_kvm_binary from image_creator.util import FatalError, get_kvm_binary
...@@ -168,8 +169,9 @@ class VM(object): ...@@ -168,8 +169,9 @@ class VM(object):
if self.serial is not None: if self.serial is not None:
try: try:
os.unlink(self.serial) os.unlink(self.serial)
except FileNotFoundError: except OSError as e:
pass if errno.errorcode[e.errno] != 'ENOENT': # File not found
raise
def wait_on_serial(self, timeout): def wait_on_serial(self, timeout):
"""Wait until the random token appears on the VM's serial port""" """Wait until the random token appears on the VM's serial port"""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment