diff options
author | Michael Elkins <melkins@tislabs.com> | 2016-04-29 20:19:40 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2016-04-29 20:19:40 +0000 |
commit | b0757fad0400eab4dcaa2bf0604b8f3d85c7b734 (patch) | |
tree | 3378afece97f07d112862c943f2e26a859d5d893 /rpki | |
parent | 80318506218ecfb3b6d71477edf9b0536a83bef9 (diff) |
gracefully catch and log exception from zookeeper
svn path=/branches/tk705/; revision=6413
Diffstat (limited to 'rpki')
-rw-r--r-- | rpki/gui/app/glue.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/rpki/gui/app/glue.py b/rpki/gui/app/glue.py index c312618f..745638c4 100644 --- a/rpki/gui/app/glue.py +++ b/rpki/gui/app/glue.py @@ -36,6 +36,9 @@ from lxml.etree import Element, SubElement from django.contrib.auth.models import User from django.db.transaction import atomic +import logging + +logger = logging.getLogger(__name__) def ghostbuster_to_vcard(gbr): """Convert a GhostbusterRequest object into a vCard object.""" @@ -79,8 +82,14 @@ def list_received_resources(log, conf): z = Zookeeper(handle=conf.handle, disable_signal_handlers=True) req = Element(tag_msg, nsmap=nsmap, type="query", version=version) - SubElement(req, tag_list_received_resources, tenant_handle=conf.handle) - pdus = z.call_rpkid(req) + SubElement(req, tag_list_received_resources, tenant_handle=conf.handle, tag=conf.handle) + try: + pdus = z.call_rpkid(req) + except Exception as err: + logger.error('caught exception while attempting to query rpkid') + logger.exception(err) + return + # pdus is sometimes None (see https://trac.rpki.net/ticket/681) if pdus is None: print >>log, 'error: call_rpkid() returned None for handle %s when fetching received resources' % conf.handle |