Skip to content

Commit ddcd795

Browse files
committed
Throw error and exit on netplan parse exceptions
Exceptions related to netplan parse or validate operations are supposed to throw error and return proper error code. Resolves https://bugs.launchpad.net/netplan/+bug/2104373 Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
1 parent 84302d7 commit ddcd795

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

netplan_cli/cli/core.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import logging
2222
import os
23+
import sys
2324

2425
from . import utils
2526
from netplan import NetplanException, NetplanValidationException, NetplanParserException
@@ -59,7 +60,10 @@ def main(self):
5960
except NetplanParserException as e:
6061
message = f'{e.filename}:{e.line}:{e.column}: {e}'
6162
logging.warning(f'Command failed: {message}')
63+
sys.exit(1)
6264
except NetplanValidationException as e:
6365
logging.warning(f'Command failed: {e.filename}: {e}')
66+
sys.exit(1)
6467
except NetplanException as e:
6568
logging.warning(f'Command failed: {e}')
69+
sys.exit(1)

0 commit comments

Comments
 (0)