From 2b5635d4574717761a58efaefbe0954c862ca852 Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Wed, 19 Nov 2014 17:48:02 -0800 Subject: [PATCH] Fix 'source' file error handling Ticket: Reviewed By: Testing Done: --- ifupdown/networkinterfaces.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ifupdown/networkinterfaces.py b/ifupdown/networkinterfaces.py index 561654d..d2ec8e7 100644 --- a/ifupdown/networkinterfaces.py +++ b/ifupdown/networkinterfaces.py @@ -141,7 +141,12 @@ class networkInterfaces(): self.logger.debug('processing sourced line ..\'%s\'' %lines[cur_idx]) sourced_file = re.split(self._ws_split_regex, lines[cur_idx], 2)[1] if sourced_file: - for f in glob.glob(sourced_file): + filenames = glob.glob(sourced_file) + if not filenames: + self._parse_error(self._currentfile, lineno, + 'cannot find source file %s' %sourced_file) + return 0 + for f in filenames: self.read_file(f) else: self._parse_error(self._currentfile, lineno,