Details
-
Type: Bug
-
Status: Closed
-
Priority: Minor
-
Resolution: Incomplete
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Difficulty:Medium
Description
UNHANDLED EXCEPTION (2016-02-15 18:18:48.738598)
BRANCH: feature/microservices TIP: 0c3c332800f5
PROCESS: ./services/web/service.py
ERROR FINGERPRINT: e9e272e3-2e72-57fc-be69-46104e9e0695
WORKING DIRECTORY: /opt/noc
EXCEPTION: <class 'pymongo.errors.OperationFailure'> command SON([('$eval', Code('\n function() {\n var c = {}\n db[collection].find(query,
).forEach(function(doc)
{\n var oid = doc.vars.trap_oid;\n c[oid] = (c[oid] || 0) + 1;\n });\n return c;\n }\n ', {'query': {'event_class': ObjectId('56b1cddfb35f9e377f599155')}, 'options': {}, 'collection': 'noc.events.active'})), ('args', ())]) on namespace noc.$cmd failed: not authorized on noc to execute command { $eval: CodeWScope(function() {
var c = {}
db[collection].find(query, {"vars": 1}).forEach(function(doc) { var oid = doc.vars.trap_oid; c[oid] = (c[oid] || 0) + 1; });
return c;
}
, { query: { event_class: ObjectId('56b1cddfb35f9e377f599155') }, options: {}, collection: "noc.events.active" }), args: [] }
START OF TRACEBACK
------------------------------------------------------------------------
File: local/lib/python2.7/site-packages/pymongo/helpers.py (Line: 182)
Function: _check_command_response
175 # findAndModify with upsert can raise duplicate key error
176 if code in (11000, 11001, 12582):
177 raise DuplicateKeyError(errmsg, code, response)
178 elif code == 50:
179 raise ExecutionTimeout(errmsg, code, response)
180
181 msg = msg or "%s"
182 ==> raise OperationFailure(msg % errmsg, code, response)
183
184
185 def _check_write_command_response(results):
186 """Backward compatibility helper for write command error handling.
187 """
188 errors = [res for res in results
Variables:
reset =
<bound method MongoReplicaSetClient.disconnect of MongoReplicaSetClient([u'noc01:27017', u'noc02:27017'])>
code = 13
allowable_errors = []
details =
{u'code': 13,
u'errmsg': u'not authorized on noc to execute command { $eval: CodeWScope( \n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {n var oid = doc.vars.trap_oid;n c[oid] = (c[oid] || 0) + 1;n }
);\n return c;\n }\n , { query:
{ event_class: ObjectId(\'56b1cddfb35f9e377f599155\') }, options: {}, collection: "noc.events.active" }), args: [] }',
u'ok': 0.0}
msg =
u'command SON([(\'$eval\', Code(\'
n function() {
n var c = {}
n db[collection].find(query,
).forEach(function(doc)
{\\n var oid = doc.vars.trap_oid;\\n c[oid] = (c[oid] || 0) + 1;\\n });n return c;
n }
n \', {\'query\': {\'event_class\': ObjectId(\'56b1cddfb35f9e377f599155\')}, \'options\': {}, \'collection\': \'noc.events.active\'})), (\'args\', ())]) on namespace noc.$cmd failed: %s'
response =
{u'code': 13,
u'errmsg': u'not authorized on noc to execute command { $eval: CodeWScope( \n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {\n var oid = doc.vars.trap_oid;\n c[oid] = (c[oid] || 0) + 1;\n });\n return c;\n }\n , { query: { event_class: ObjectId(\'56b1cddfb35f9e377f599155\') }, options: {}, collection: "noc.events.active" }), args: [] }',
u'ok': 0.0}
errmsg =
u'not authorized on noc to execute command { $eval: CodeWScope( \n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {n var oid = doc.vars.trap_oid;n c[oid] = (c[oid] || 0) + 1;n });\n return c;\n }\n , { query: { event_class: ObjectId(\'56b1cddfb35f9e377f599155\') }, options: {}, collection: "noc.events.active" }), args: [] }'
------------------------------------------------------------------------
File: local/lib/python2.7/site-packages/pymongo/database.py (Line: 345)
Function: _command
338 for doc in cursor:
339 result = doc
340
341 if check:
342 msg = "command %s on namespace %s failed: %%s" % (
343 repr(command).replace("%", "%%"), self.name + '.$cmd')
344 helpers._check_command_response(result, self.connection.disconnect,
345 ==> msg, allowable_errors)
346
347 return result, cursor.conn_id
348
349 def command(self, command, value=1,
350 check=True, allowable_errors=[],
351 uuid_subtype=OLD_UUID_SUBTYPE, compile_re=True, **kwargs):
Variables:
kwargs = {'args': ()}
allowable_errors = []
doc =
{u'code': 13,
u'errmsg': u'not authorized on noc to execute command { $eval: CodeWScope( \n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {\n var oid = doc.vars.trap_oid;\n c[oid] = (c[oid] || 0) + 1;\n });\n return c;\n }\n , { query: { event_class: ObjectId(\'56b1cddfb35f9e377f599155\') }, options: {}, collection: "noc.events.active" }), args: [] }',
u'ok': 0.0}
self =
Database(MongoReplicaSetClient([u'noc01:27017', u'noc02:27017']), u'noc')
must_use_master = True
value =
Code('\n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {n var oid = doc.vars.trap_oid;n c[oid] = (c[oid] || 0) + 1;n });\n return c;\n }\n ', {'query': {'event_class': ObjectId('56b1cddfb35f9e377f599155')}, 'options': {}, 'collection': 'noc.events.active'})
cursor = <pymongo.cursor.Cursor object at 0x7f6264ce64d0>
command =
SON([('$eval', Code('\n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {\n var oid = doc.vars.trap_oid;\n c[oid] = (c[oid] || 0) + 1;\n });\n return c;\n }\n ', {'query': {'event_class': ObjectId('56b1cddfb35f9e377f599155')}, 'options': {}, 'collection': 'noc.events.active'})), ('args', ())])
result =
{u'code': 13,
u'errmsg': u'not authorized on noc to execute command { $eval: CodeWScope( \n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {n var oid = doc.vars.trap_oid;n c[oid] = (c[oid] || 0) + 1;n });\n return c;\n }\n , { query: { event_class: ObjectId(\'56b1cddfb35f9e377f599155\') }, options: {}, collection: "noc.events.active" }), args: [] }',
u'ok': 0.0}
fields = None
msg =
u'command SON([(\'$eval\', Code(\'
n function() {
n var c = {}
n db[collection].find(query, {"vars": 1}).forEach(function(doc) {\n var oid = doc.vars.trap_oid;\n c[oid] = (c[oid] || 0) + 1;\n }
);
n return c;
n }
n \', {\'query\':
, \'options\': {}, \'collection\': \'noc.events.active\'})), (\'args\', ())]) on namespace noc.$cmd failed: %s'
extra_opts =
{'_must_use_master': True,
'_uuid_subtype': 3,
'as_class': None,
'compile_re': True,
'read_preference': 0,
'secondary_acceptable_latency_ms': 15.0,
'slave_okay': True,
'tag_sets': [{}]}
compile_re = True
check = True
uuid_subtype = 3
command_name = '$eval'
------------------------------------------------------------------------
File: local/lib/python2.7/site-packages/pymongo/database.py (Line: 439)
Function: command
432 `command` can be a string in addition to a full document.
433 .. versionadded:: 1.4
434
435 .. mongodoc:: commands
436 .. _localThreshold: http://docs.mongodb.org/manual/reference/mongos/#cmdoption-mongos--localThreshold
437 """
438 return self._command(command, value, check, allowable_errors,
439 ==> uuid_subtype, compile_re, **kwargs)[0]
440
441 def collection_names(self, include_system_collections=True):
442 """Get a list of all the collection names in this database.
443
444 :Parameters:
445 - `include_system_collections` (optional): if ``False`` list
Variables:
allowable_errors = []
self =
Database(MongoReplicaSetClient([u'noc01:27017', u'noc02:27017']), u'noc')
value =
Code('\n function() {\n var c = {}\n db[collection].find(query,
).forEach(function(doc)
{\n var oid = doc.vars.trap_oid;\n c[oid] = (c[oid] || 0) + 1;\n });\n return c;\n }\n ', {'query': {'event_class': ObjectId('56b1cddfb35f9e377f599155')}, 'options': {}, 'collection': 'noc.events.active'})command = '$eval'
kwargs = {'args': (), 'read_preference': 0}
compile_re = True
check = True
uuid_subtype = 3
------------------------------------------------------------------------
File: local/lib/python2.7/site-packages/pymongo/database.py (Line: 1041)
Function: eval
1034 passed to the `code` being evaluated
1035 """
1036 if not isinstance(code, Code):
1037 code = Code(code)
1038
1039 result = self.command("$eval", code,
1040 read_preference=ReadPreference.PRIMARY,
1041 ==> args=args)
1042 return result.get("retval", None)
1043
1044 def _call_(self, *args, **kwargs):
1045 """This is only here so that some API misusages are easier to debug.
1046 """
1047 raise TypeError("'Database' object is not callable. If you meant to "
Variables:
code =
Code('\n function() {\n var c = {}\n db[collection].find(query, {"vars": 1}).forEach(function(doc) {n var oid = doc.vars.trap_oid;n c[oid] = (c[oid] || 0) + 1;n }
);\n return c;\n }\n ', {'query':
{'event_class': ObjectId('56b1cddfb35f9e377f599155')}, 'options': {}, 'collection': 'noc.events.active'})
self =
Database(MongoReplicaSetClient([u'noc01:27017', u'noc02:27017']), u'noc')
args = ()
------------------------------------------------------------------------
File: local/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1201)
Function: exec_js
1194 if queryset._where_clause:
1195 query['$where'] = queryset._where_clause
1196
1197 scope['query'] = query
1198 code = Code(code, scope=scope)
1199
1200 db = queryset._document._get_db()
1201 ==> return db.eval(code, *fields)
1202
1203 def where(self, where_clause):
1204 """Filter ``QuerySet`` results with a ``$where`` clause (a Javascript
1205 expression). Performs automatic field name substitution like
1206 :meth:`mongoengine.queryset.Queryset.exec_js`.
1207
Variables:
code =
Code('\n function() {\n var c = {}\n db[collection].find(query,
).forEach(function(doc)
{\n var oid = doc.vars.trap_oid;\n c[oid] = (c[oid] || 0) + 1;\n });\n return c;\n }\n ', {'query':
{'event_class': ObjectId('56b1cddfb35f9e377f599155')}, 'options': {}, 'collection': 'noc.events.active'})
fields = []
db =
Database(MongoReplicaSetClient([u'noc01:27017', u'noc02:27017']), u'noc')
self =
[<ActiveEvent: 56c07079041b41024dbfd404>, <ActiveEvent: 56c0707ab35f9e0260b1431f>, <ActiveEvent: 56c0707ab35f9e0260b14320>, <ActiveEvent: 56c07081041b41024dbfd417>, <ActiveEvent: 56c07085041b41024dbfd41e>, <ActiveEvent: 56c07088041b41024dbfd420>, <ActiveEvent: 56c07088b35f9e0260b1433f>, <ActiveEvent: 56c07089b35f9e0260b14341>, <ActiveEvent: 56c0708a041b41024dbfd422>, <ActiveEvent: 56c0708cb35f9e0260b14347>, <ActiveEvent: 56c0708cb35f9e0260b1434b>, <ActiveEvent: 56c0708d041b41024dbfd42b>, <ActiveEvent: 56c07092041b41024dbfd46d>, <ActiveEvent: 56c07094041b41024dbfd484>, <ActiveEvent: 56c07097b35f9e0260b14391>, <ActiveEvent: 56c07098b35f9e0260b14398>, <ActiveEvent: 56c07098b35f9e0260b1439a>, <ActiveEvent: 56c0709f041b41024dbfd4cc>, <ActiveEvent: 56c070a5041b41024dbfd4d7>, <ActiveEvent: 56c070ab041b41024dbfd4f1>, '...(remaining elements truncated)...']
queryset =
[<ActiveEvent: 56c07079041b41024dbfd404>, <ActiveEvent: 56c0707ab35f9e0260b1431f>, <ActiveEvent: 56c0707ab35f9e0260b14320>, <ActiveEvent: 56c07081041b41024dbfd417>, <ActiveEvent: 56c07085041b41024dbfd41e>, <ActiveEvent: 56c07088041b41024dbfd420>, <ActiveEvent: 56c07088b35f9e0260b1433f>, <ActiveEvent: 56c07089b35f9e0260b14341>, <ActiveEvent: 56c0708a041b41024dbfd422>, <ActiveEvent: 56c0708cb35f9e0260b14347>, <ActiveEvent: 56c0708cb35f9e0260b1434b>, <ActiveEvent: 56c0708d041b41024dbfd42b>, <ActiveEvent: 56c07092041b41024dbfd46d>, <ActiveEvent: 56c07094041b41024dbfd484>, <ActiveEvent: 56c07097b35f9e0260b14391>, <ActiveEvent: 56c07098b35f9e0260b14398>, <ActiveEvent: 56c07098b35f9e0260b1439a>, <ActiveEvent: 56c0709f041b41024dbfd4cc>, <ActiveEvent: 56c070a5041b41024dbfd4d7>, <ActiveEvent: 56c070ab041b41024dbfd4f1>, '...(remaining elements truncated)...']
collection = 'noc.events.active'
scope =
{'collection': 'noc.events.active',
'options': {},
'query': {'event_class': ObjectId('56b1cddfb35f9e377f599155')}}
query =
options = {}
------------------------------------------------------------------------
File: fm/apps/reportunclassifiedoids/views.py (Line: 30)
Function: get_data
23 });
24 return c;
25 }
26 """
27
28 def get_data(self, **kwargs):
29 c = EventClass.objects.filter(name="Unknown | SNMP Trap").first()
30 ==> oids = ActiveEvent.objects.filter(event_class=c.id).exec_js(self.c_f)
31 data = [(o, MIB.get_name(o), c) for o, c in oids.items()]
32 data = sorted(data, key=lambda x: -x[2])
33 return self.from_dataset(title=self.title,
34 columns=["OID", "Name",
35 TableColumn("Count", format="integer",
36 align="right", total="sum")],
Variables:
c = <EventClass: Unknown | SNMP Trap>
self =
<noc.fm.apps.reportunclassifiedoids.views.ReportUnclassifiedOIDs object at 0x7f626542d390>
kwargs = {}
------------------------------------------------------------------------
File: lib/app/simplereport.py (Line: 635)
Function: report_html
628 """
629 return Report()
630
631 def report_html(self, **kwargs):
632 """
633 Render HTML
634 """
635 ==> return self.get_data(**kwargs).to_html()
636
637 def report_csv(self, **kwargs):
638 """
639 Render CSV
640 """
641 return self.get_data(**kwargs).to_csv()
Variables:
self =
<noc.fm.apps.reportunclassifiedoids.views.ReportUnclassifiedOIDs object at 0x7f626542d390>
kwargs = {}
------------------------------------------------------------------------
File: lib/app/reportapplication.py (Line: 81)
Function: view_report
74 else:
75 form = form_class()
76 # No POST or error - render form
77 if not query:
78 return self.render(request, "report_form.html",
79 form=form, app=self, is_report=True)
80 # Build result
81 ==> rdata = getattr(self, "report_%s" % format)(**query)
82 # Render result
83 if format == "html":
84 return self.render(request, "report.html",
85 data=rdata, app=self, is_report=True)
86 else:
87 return self.render_response(rdata,
Variables:
query = {}
self =
<noc.fm.apps.reportunclassifiedoids.views.ReportUnclassifiedOIDs object at 0x7f626542d390>
request =
<WSGIRequest
path:/fm/reportunclassifiedoids/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:
,
META:
>
form_class = None
format = 'html'
------------------------------------------------------------------------
File: lib/app/site.py (Line: 248)
Function: inner
241 a = dict((k, v[0] if len(v) == 1 else v)
242 for k, v in request.GET.lists())
243 app_logger.debug("API %s %s %s",
244 request.method, request.path, a)
245 # Call handler
246 v._dict_["hits_metric"] += 1
247 with v._dict_["time_metric"].timer():
248 ==> r = v(request, *args, **kwargs)
249 # Dump SQL statements
250 if self.log_sql_statements:
251 from django.db import connections
252 tsc = 0
253 sc = defaultdict(int)
254 for conn in connections.all():
Variables:
args = ()
view_map =
Form = <class 'django.forms.forms.Form'>
PermissionDenied = <class 'noc.lib.app.access.PermissionDenied'>
DictParameter = <class 'noc.sa.interfaces.base.DictParameter'>
self = <noc.lib.app.site.Site object at 0x7f626f8a6e90>
v =
<bound method ReportUnclassifiedOIDs.view_report of <noc.fm.apps.reportunclassifiedoids.views.ReportUnclassifiedOIDs object at 0x7f626542d390>>
request =
<WSGIRequest
path:/fm/reportunclassifiedoids/,
GET:<QueryDict: {}>,
POST:<QueryDict: {}>,
COOKIES:
,
META:
>
app_logger = <logging.Logger object at 0x7f626542d810>
InterfaceTypeError = <type 'exceptions.ValueError'>
to_log_api_call = False
kwargs = {}
nq = <function nq at 0x7f6264e74de8>
app =
<noc.fm.apps.reportunclassifiedoids.views.ReportUnclassifiedOIDs object at 0x7f626542d390>
------------------------------------------------------------------------
END OF TRACEBACK