|
1
|
|
|
# encoding: utf-8 |
|
2
|
|
|
""" |
|
3
|
|
|
report.py |
|
4
|
|
|
|
|
5
|
|
|
Created by Thomas Mangin on 2014-12-30. |
|
6
|
|
|
Copyright (c) 2009-2017 Exa Networks. All rights reserved. |
|
7
|
|
|
License: 3-clause BSD. (See the COPYRIGHT file) |
|
8
|
|
|
""" |
|
9
|
|
|
|
|
10
|
|
|
import sys |
|
11
|
|
|
import platform |
|
12
|
|
|
import traceback |
|
13
|
|
|
from io import StringIO |
|
14
|
|
|
|
|
15
|
|
|
from exabgp.version import version |
|
16
|
|
|
from exabgp.environment import Env |
|
17
|
|
|
from exabgp.environment import ROOT |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
from exabgp.logger import log |
|
21
|
|
|
|
|
22
|
|
|
|
|
23
|
|
|
def format_exception(exception): |
|
24
|
|
|
buff = StringIO() |
|
25
|
|
|
traceback.print_exc(file=buff) |
|
26
|
|
|
trace = buff.getvalue() |
|
27
|
|
|
buff.close() |
|
28
|
|
|
|
|
29
|
|
|
return '\n'.join([_NO_PANIC + _INFO, '', '', str(type(exception)), str(exception), trace, _FOOTER]) |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
def format_panic(dtype, value, trace): |
|
33
|
|
|
result = _PANIC + _INFO |
|
34
|
|
|
|
|
35
|
|
|
result = "-- Traceback\n\n" |
|
36
|
|
|
result += traceback.format_exception(dtype, value, trace) |
|
37
|
|
|
|
|
38
|
|
|
result += "\n\n-- Configuration\n\n" |
|
39
|
|
|
result += log.config() |
|
40
|
|
|
result += "\n\n-- Logging History\n\n" |
|
41
|
|
|
result += log.history() |
|
42
|
|
|
result += "\n\n\n" |
|
43
|
|
|
|
|
44
|
|
|
result += _FOOTER |
|
45
|
|
|
|
|
46
|
|
|
return result |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
_INFO = """ |
|
50
|
|
|
ExaBGP version : %s |
|
51
|
|
|
Python version : %s |
|
52
|
|
|
System Uname : %s |
|
53
|
|
|
System MaxInt : %s |
|
54
|
|
|
Root : %s |
|
55
|
|
|
|
|
56
|
|
|
Environment: |
|
57
|
|
|
%s |
|
58
|
|
|
""" % ( |
|
59
|
|
|
version, |
|
60
|
|
|
sys.version.replace('\n', ' '), |
|
61
|
|
|
platform.version(), |
|
62
|
|
|
str(sys.maxsize), |
|
63
|
|
|
ROOT, |
|
64
|
|
|
'\n'.join(Env.iter_env(diff=True)) |
|
65
|
|
|
) |
|
66
|
|
|
|
|
67
|
|
|
|
|
68
|
|
|
_PANIC = """ |
|
69
|
|
|
******************************************************************************** |
|
70
|
|
|
EXABGP HAD AN INTERNAL ISSUE / HELP US FIX IT |
|
71
|
|
|
******************************************************************************** |
|
72
|
|
|
|
|
73
|
|
|
Sorry, you encountered a problem with ExaBGP and we could not keep the program |
|
74
|
|
|
running. |
|
75
|
|
|
|
|
76
|
|
|
There are a few things you can do to help us (and yourself): |
|
77
|
|
|
- make sure you are running the latest version of the code available at |
|
78
|
|
|
https://github.com/Exa-Networks/exabgp/releases/latest |
|
79
|
|
|
- if so report the issue on https://github.com/Exa-Networks/exabgp/issues |
|
80
|
|
|
so it can be fixed (github can be searched for similar reports) |
|
81
|
|
|
|
|
82
|
|
|
PLEASE, when reporting, do include as much information as you can: |
|
83
|
|
|
- do not obfuscate any data (feel free to send us a private email with the |
|
84
|
|
|
extra information if your business policy is strict on information sharing) |
|
85
|
|
|
https://github.com/Exa-Networks/exabgp/wiki/FAQ |
|
86
|
|
|
- if you can reproduce the issue, run ExaBGP with the command line option -d |
|
87
|
|
|
it provides us with much needed information to fix problems quickly |
|
88
|
|
|
- include the information presented below |
|
89
|
|
|
|
|
90
|
|
|
Should you not receive an acknowledgment of your issue on github (assignement, |
|
91
|
|
|
comment, or similar) within a few hours, feel free to email us to make sure |
|
92
|
|
|
it was not overlooked. (please keep in mind the authors are based in GMT/Europe) |
|
93
|
|
|
|
|
94
|
|
|
******************************************************************************** |
|
95
|
|
|
-- Please provide ALL the information below on : |
|
96
|
|
|
-- https://github.com/Exa-Networks/exabgp/issues |
|
97
|
|
|
******************************************************************************** |
|
98
|
|
|
""" |
|
99
|
|
|
|
|
100
|
|
|
|
|
101
|
|
|
_NO_PANIC = """ |
|
102
|
|
|
******************************************************************************** |
|
103
|
|
|
EXABGP MISBEHAVED / HELP US FIX IT |
|
104
|
|
|
******************************************************************************** |
|
105
|
|
|
|
|
106
|
|
|
Sorry, you encountered a problem with ExaBGP, as the problem only affects one |
|
107
|
|
|
peer, we are trying to keep the program running. |
|
108
|
|
|
|
|
109
|
|
|
There are a few things you can do to help us (and yourself): |
|
110
|
|
|
- make sure you are running the latest version of the code available at |
|
111
|
|
|
https://github.com/Exa-Networks/exabgp/releases/latest |
|
112
|
|
|
- if so report the issue on https://github.com/Exa-Networks/exabgp/issues |
|
113
|
|
|
so it can be fixed (github can be searched for similar reports) |
|
114
|
|
|
|
|
115
|
|
|
PLEASE, when reporting, do include as much information as you can: |
|
116
|
|
|
- do not obfuscate any data (feel free to send us a private email with the |
|
117
|
|
|
extra information if your business policy is strict on information sharing) |
|
118
|
|
|
https://github.com/Exa-Networks/exabgp/wiki/FAQ |
|
119
|
|
|
- if you can reproduce the issue, run ExaBGP with the command line option -d |
|
120
|
|
|
it provides us with much needed information to fix problems quickly |
|
121
|
|
|
- include the information presented below |
|
122
|
|
|
|
|
123
|
|
|
Should you not receive an acknowledgment of your issue on github (assignement, |
|
124
|
|
|
comment, or similar) within a few hours, feel free to email us to make sure |
|
125
|
|
|
it was not overlooked. (please keep in mind the authors are based in GMT/Europe) |
|
126
|
|
|
|
|
127
|
|
|
******************************************************************************** |
|
128
|
|
|
-- Please provide ALL the information below on : |
|
129
|
|
|
-- https://github.com/Exa-Networks/exabgp/issues |
|
130
|
|
|
******************************************************************************** |
|
131
|
|
|
""" |
|
132
|
|
|
|
|
133
|
|
|
|
|
134
|
|
|
_FOOTER = """\ |
|
135
|
|
|
******************************************************************************** |
|
136
|
|
|
-- Please provide _ALL_ the information above on : |
|
137
|
|
|
-- https://github.com/Exa-Networks/exabgp/issues |
|
138
|
|
|
******************************************************************************** |
|
139
|
|
|
""" |
|
140
|
|
|
|