From nobody Thu Mar 28 17:48:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1486746333602788.8175243364965; Fri, 10 Feb 2017 09:05:33 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id E00838205E5; Fri, 10 Feb 2017 17:05:30 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 1DD4D820592 for ; Fri, 10 Feb 2017 17:05:18 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1AH3WHZ132960 for ; Fri, 10 Feb 2017 12:05:17 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0b-001b2d01.pphosted.com with ESMTP id 28hf9xfdf9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 10 Feb 2017 12:05:17 -0500 Received: from localhost by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Feb 2017 15:03:44 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 10 Feb 2017 15:03:42 -0200 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 54516352006E for ; Fri, 10 Feb 2017 12:03:08 -0500 (EST) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1AH3fud33947700 for ; Fri, 10 Feb 2017 15:03:41 -0200 Received: from d24av05.br.ibm.com (localhost [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1AH3f8q021944 for ; Fri, 10 Feb 2017 15:03:41 -0200 Received: from t440.ibm.com ([9.85.143.65]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1AH3dN9021927; Fri, 10 Feb 2017 15:03:40 -0200 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Fri, 10 Feb 2017 15:03:33 -0200 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17021017-0028-0000-0000-000001942ACC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17021017-0029-0000-0000-000014905BF8 Message-Id: <1486746213-3794-1-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-10_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702100169 Subject: [Kimchi-devel] [PATCH] [Wok] Avoid log functionality to break due to missing argument X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When new args are added to existing error messages, expansion of old log entries for that message will fail due to lack of new arg. Fix that by ignoring KeyError execptions. Signed-off-by: Lucio Correia Reviewed-By: Ramon Medeiros --- src/wok/message.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wok/message.py b/src/wok/message.py index ff4cbc9..f39701c 100644 --- a/src/wok/message.py +++ b/src/wok/message.py @@ -86,7 +86,16 @@ class WokMessage(object): =20 def get_text(self, prepend_code=3DTrue, translate=3DTrue): msg =3D self._get_text(translate) - msg =3D decode_value(msg) % self.args + + try: + msg =3D decode_value(msg) % self.args + except KeyError, e: + # When new args are added to existing log messages, old entrie= s in + # log for the same message would fail due to lack of that new = arg. + # This avoids whole log functionality to break due to that, wh= ile + # registers the problem. + msg =3D decode_value(msg) + cherrypy.log.error_log.error("KeyError: %s - %s" % (str(e), ms= g)) =20 if prepend_code: return "%s: %s" % (self.code, msg) --=20 2.7.4 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel