[1/3] Load configurations only if the config file exists

Message ID 20171010135525.1102-1-jonatan.schlag@ipfire.org
State New
Headers
Series [1/3] Load configurations only if the config file exists |

Commit Message

Jonatan Schlag Oct. 11, 2017, 12:55 a.m. UTC
  Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
 src/buildservice/__init__.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Patch

diff --git a/src/buildservice/__init__.py b/src/buildservice/__init__.py
index be81ba0..9619bfe 100644
--- a/src/buildservice/__init__.py
+++ b/src/buildservice/__init__.py
@@ -84,8 +84,11 @@  class Backend(object):
 
 		# Load all configuration files
 		for path in paths:
-			log.debug("Loading configuration from %s" % path)
-			c.read(path)
+			if os.path.exists(path):
+				log.debug("Loading configuration from %s" % path)
+				c.read(path)
+			else:
+				log.error("No such file %s" % path)
 
 		return c