Skip to content

Commit 21892f1

Browse files
committed
logger: Exception handling and proper exit on no device file found
1 parent 364cc30 commit 21892f1

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

logger/fleet_commander_logger.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,11 @@ def __init__(self, path=DEFAULT_SPICE_CHANNEL_DEV, retry_interval=1000):
9090
self.queue = []
9191
self.timeout = 0
9292

93-
self.fd = open(self.path, 'wb', 0)
93+
try:
94+
self.fd = open(self.path, 'wb', 0)
95+
except FileNotFoundError as e:
96+
logging.error('Can\'t open device file %s. Use -n or --no-dev for non Fleet Commander VM session' % self.path)
97+
sys.exit(1)
9498

9599
def _perform_submits(self):
96100
if len(self.queue) < 1:

0 commit comments

Comments
 (0)