From e8be76095e44b271e080cf8f0ad7633ae042790b Mon Sep 17 00:00:00 2001 From: root Date: Thu, 23 Jun 2016 14:10:31 +0000 Subject: [PATCH 1/2] releng: fix typo in s390 details --- inventory/host_vars/compose-s390-01.s390.fedoraproject.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inventory/host_vars/compose-s390-01.s390.fedoraproject.org b/inventory/host_vars/compose-s390-01.s390.fedoraproject.org index 60bc410d11..5ec3ff3c35 100644 --- a/inventory/host_vars/compose-s390-01.s390.fedoraproject.org +++ b/inventory/host_vars/compose-s390-01.s390.fedoraproject.org @@ -14,7 +14,7 @@ main_bridge: br1 koji_hub_nfs: "fedora_s390/data" kojipkgs_url: s390pkgs.fedoraproject.org -kojihub_url: 390koji.fedoraproject.org/kojihub +kojihub_url: s390.koji.fedoraproject.org/kojihub kojihub_scheme: https koji_server_url: "http://s390.koji.fedoraproject.org/kojihub" From 0398171c7bcb6df722be3c71d9481d4b8029d115 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Thu, 23 Jun 2016 16:15:29 +0200 Subject: [PATCH 2/2] Try logging the message_id when reporting an error --- roles/fedmsg/base/templates/logging.py.j2 | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/roles/fedmsg/base/templates/logging.py.j2 b/roles/fedmsg/base/templates/logging.py.j2 index e557cfe5ce..4f9c70ba39 100644 --- a/roles/fedmsg/base/templates/logging.py.j2 +++ b/roles/fedmsg/base/templates/logging.py.j2 @@ -76,8 +76,47 @@ class ContextInjector(logging.Filter): if seen_errors[key] > error_limit: record.farewell = radio_silence % error_limit + msg_id = "" + try: + msg = self.get_msg_object() + if isinstance(msg, dict): + if 'msg_id' in msg: + msg_id = msg['msg_id'] + elif 'msg' in msg: + if 'msg_id' in msg['msg']: + msg_id = msg['msg']['msg_id'] + except: + pass + + record.msg_id = msg_id + return True + @staticmethod + def get_msg_object(): + """ Return the current request object + + This is insane. + + Unless your method or function is passed a reference to the trac + 'request' object, there is no way to get ahold of the currently + logged in user. Furthermore, there is no way globally to get ahold + of the current request object. + + Here, we crawl our way back up the call stack until we find the + first place that has 'req' as a local instance variable and attempt + to extract the username of the current user from that. + + Please forgive me (and Ralph, the original author of this code). + """ + + for frame in (f[0] for f in inspect.stack()): + if 'msg' in frame.f_locals: + return frame.f_locals['msg'] + + # This code is reached if there's no Request. Most common case is trac-admin + return None + @staticmethod def format_callstack(): for i, frame in enumerate(f[0] for f in inspect.stack()): @@ -126,6 +165,7 @@ host: %(host)s PID: %(pid)s name: %(proc_name)s command: %(command_line)s +msg_id: %(msg_id)s Callstack that lead to the logging statement --------------------------------------------