From patchwork Wed Oct 11 00:55:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonatan Schlag X-Patchwork-Id: 1453 Return-Path: Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id 3653260BF3 for ; Tue, 10 Oct 2017 15:55:32 +0200 (CEST) Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id F33FE2837; Tue, 10 Oct 2017 15:55:31 +0200 (CEST) Received: from bockland.local.familyschlag (unknown [10.172.1.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 4BE5C2872; Tue, 10 Oct 2017 15:55:30 +0200 (CEST) From: Jonatan Schlag To: pakfire@lists.ipfire.org Subject: [PATCH 2/3] Catch errors when we try to parse our config Date: Tue, 10 Oct 2017 15:55:24 +0200 Message-Id: <20171010135525.1102-2-jonatan.schlag@ipfire.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171010135525.1102-1-jonatan.schlag@ipfire.org> References: <20171010135525.1102-1-jonatan.schlag@ipfire.org> X-BeenThere: pakfire@lists.ipfire.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Mailinglist for the Pakfire Build System." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: pakfire-bounces@lists.ipfire.org Sender: "Pakfire" Signed-off-by: Jonatan Schlag --- src/buildservice/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/buildservice/__init__.py b/src/buildservice/__init__.py index 9619bfe..7a744f5 100644 --- a/src/buildservice/__init__.py +++ b/src/buildservice/__init__.py @@ -94,10 +94,13 @@ class Backend(object): @lazy_property def db(self): - name = self.config.get("database", "name") - hostname = self.config.get("database", "hostname") - user = self.config.get("database", "user") - password = self.config.get("database", "password") + try: + name = self.config.get("database", "name") + hostname = self.config.get("database", "hostname") + user = self.config.get("database", "user") + password = self.config.get("database", "password") + except ConfigParser.Error as e: + log.error("Error parsing the config: %s" % e.message) log.debug("Connecting to database %s @ %s" % (name, hostname))