Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.74 KB | None | 0 0
  1. Working directory: /opt/noc
  2. <class 'mongoengine.errors.InvalidQueryError'>
  3. Cannot resolve field "managed_object"
  4. START OF TRACEBACK
  5. ------------------------------------------------------------------------
  6. File: /usr/lib/python2.7/site-packages/mongoengine/queryset/transform.py (Line: 59)
  7. Function: query
  8. 52 negate = True
  9. 53
  10. 54 if _doc_cls:
  11. 55 # Switch field names to proper names [set in Field(name='foo')]
  12. 56 try:
  13. 57 fields = _doc_cls._lookup_field(parts)
  14. 58 except Exception, e:
  15. 59 ==> raise InvalidQueryError(e)
  16. 60 parts = []
  17. 61
  18. 62 cleaned_fields = []
  19. 63 for field in fields:
  20. 64 append_field = True
  21. 65 if isinstance(field, basestring):
  22. Variables:
  23. mongo_query = {}
  24. _field_operation = False
  25. e = LookUpError('Cannot resolve field "managed_object"',)
  26. p = 'managed_object'
  27. i = 0
  28. parts = ['managed_object']
  29. value = <ManagedObject: wiping-7>
  30. indices = []
  31. _doc_cls = <class 'noc.sa.models.objectcapabilities.ObjectCapabilities'>
  32. part = 'managed_object'
  33. key = 'managed_object'
  34. negate = False
  35. query = {'managed_object': <ManagedObject: wiping-7>}
  36. merge_query = defaultdict(<type 'list'>, {})
  37. op = None
  38. ------------------------------------------------------------------------
  39. File: /usr/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 80)
  40. Function: visit_query
  41. 73 def visit_combination(self, combination):
  42. 74 operator = "$and"
  43. 75 if combination.operation == combination.OR:
  44. 76 operator = "$or"
  45. 77 return {operator: combination.children}
  46. 78
  47. 79 def visit_query(self, query):
  48. 80 ==> return transform.query(self.document, **query.query)
  49. 81
  50. 82
  51. 83 class QNode(object):
  52. 84 """Base class for nodes in query trees.
  53. 85 """
  54. 86
  55. Variables:
  56. query = <mongoengine.queryset.visitor.Q object at 0x7ff726646410>
  57. self =
  58. <mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x7ff7266464d0>
  59. ------------------------------------------------------------------------
  60. File: /usr/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 157)
  61. Function: accept
  62. 150 query structures.
  63. 151 """
  64. 152
  65. 153 def __init__(self, **query):
  66. 154 self.query = query
  67. 155
  68. 156 def accept(self, visitor):
  69. 157 ==> return visitor.visit_query(self)
  70. 158
  71. 159 @property
  72. 160 def empty(self):
  73. 161 return not bool(self.query)
  74. Variables:
  75. visitor =
  76. <mongoengine.queryset.visitor.QueryCompilerVisitor object at 0x7ff7266464d0>
  77. self = <mongoengine.queryset.visitor.Q object at 0x7ff726646410>
  78. ------------------------------------------------------------------------
  79. File: /usr/lib/python2.7/site-packages/mongoengine/queryset/visitor.py (Line: 92)
  80. Function: to_query
  81. 85 """
  82. 86
  83. 87 AND = 0
  84. 88 OR = 1
  85. 89
  86. 90 def to_query(self, document):
  87. 91 query = self.accept(SimplificationVisitor())
  88. 92 ==> query = query.accept(QueryCompilerVisitor(document))
  89. 93 return query
  90. 94
  91. 95 def accept(self, visitor):
  92. 96 raise NotImplementedError
  93. 97
  94. 98 def _combine(self, other, operation):
  95. Variables:
  96. query = <mongoengine.queryset.visitor.Q object at 0x7ff726646410>
  97. self = <mongoengine.queryset.visitor.Q object at 0x7ff726646410>
  98. document = <class 'noc.sa.models.objectcapabilities.ObjectCapabilities'>
  99. ------------------------------------------------------------------------
  100. File: /usr/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 1215)
  101. Function: _query
  102. 1208 def __deepcopy__(self, memo):
  103. 1209 """Essential for chained queries with ReferenceFields involved"""
  104. 1210 return self.clone()
  105. 1211
  106. 1212 @property
  107. 1213 def _query(self):
  108. 1214 if self._mongo_query is None:
  109. 1215 ==> self._mongo_query = self._query_obj.to_query(self._document)
  110. 1216 if self._class_check:
  111. 1217 self._mongo_query.update(self._initial_query)
  112. 1218 return self._mongo_query
  113. 1219
  114. 1220 @property
  115. 1221 def _dereference(self):
  116. Variables:
  117. self = repr() failed
  118. ------------------------------------------------------------------------
  119. File: /usr/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 402)
  120. Function: delete
  121. 395 document_cls.objects(**{field_name + '__in': self}).update(
  122. 396 write_concern=write_concern, **{'unset__%s' % field_name: 1})
  123. 397 elif rule == PULL:
  124. 398 document_cls.objects(**{field_name + '__in': self}).update(
  125. 399 write_concern=write_concern,
  126. 400 **{'pull_all__%s' % field_name: self})
  127. 401
  128. 402 ==> queryset._collection.remove(queryset._query, write_concern=write_concern)
  129. 403
  130. 404 def update(self, upsert=False, multi=True, write_concern=None,
  131. 405 full_result=False, **update):
  132. 406 """Perform an atomic update on the fields matched by the query.
  133. 407
  134. 408 :param upsert: Any existing document with that "_id" is overwritten.
  135. Variables:
  136. doc = <class 'noc.sa.models.objectcapabilities.ObjectCapabilities'>
  137. self = repr() failed
  138. queryset = repr() failed
  139. has_delete_signal = False
  140. _from_doc_delete = False
  141. delete_rules = {}
  142. call_document_delete = False
  143. write_concern = {}
  144. ------------------------------------------------------------------------
  145. File: /opt/noc/main/management/commands/wipe.py (Line: 170)
  146. Function: wipe_managed_object
  147. 163 with self.log("Deleting map tasks"):
  148. 164 MapTask.objects.filter(managed_object=o).delete()
  149. 165 # Delete Managed Object's attributes
  150. 166 with self.log("Deleting object's attributes"):
  151. 167 ManagedObjectAttribute.objects.filter(managed_object=o).delete()
  152. 168 # Delete object's capabilities
  153. 169 with self.log("Deletion object's capabilities"):
  154. 170 ==> ObjectCapabilities.objects.filter(managed_object=o).delete()
  155. 171 # Finally delete object and config
  156. 172 with self.log("Deleting managed object and config"):
  157. 173 o.delete()
  158. 174
  159. 175 def get_user(self, u_id):
  160. 176 """
  161. Variables:
  162. ManagedObjectAttribute = <class 'noc.sa.models.managedobject.ManagedObjectAttribute'>
  163. o = <ManagedObject: wiping-7>
  164. ac = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  165. ArchivedEvent = <class 'noc.fm.models.archivedevent.ArchivedEvent'>
  166. NewEvent = <class 'noc.fm.models.newevent.NewEvent'>
  167. MapTask = <class 'noc.sa.models.maptask.MapTask'>
  168. self = <noc.main.management.commands.wipe.Command object at 0x7ff726663750>
  169. ArchivedAlarm = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  170. MACDB = <class 'noc.inv.models.macdb.MACDB'>
  171. FailedEvent = <class 'noc.fm.models.failedevent.FailedEvent'>
  172. ForwardingInstance = <class 'noc.inv.models.forwardinginstance.ForwardingInstance'>
  173. Link = <class 'noc.inv.models.link.Link'>
  174. DiscoveryID = <class 'noc.inv.models.discoveryid.DiscoveryID'>
  175. ActiveAlarm = <class 'noc.fm.models.activealarm.ActiveAlarm'>
  176. Address = <class 'noc.ip.models.address.Address'>
  177. Interface = <class 'noc.inv.models.interface.Interface'>
  178. ActiveEvent = <class 'noc.fm.models.activeevent.ActiveEvent'>
  179. PendingLinkCheck = <class 'noc.inv.models.pendinglinkcheck.PendingLinkCheck'>
  180. ObjectCapabilities = <class 'noc.sa.models.objectcapabilities.ObjectCapabilities'>
  181. SubInterface = <class 'noc.inv.models.subinterface.SubInterface'>
  182. ------------------------------------------------------------------------
  183. File: /opt/noc/main/management/commands/wipe.py (Line: 47)
  184. Function: handle
  185. 40 raise CommandError("Object '%s' is not found" % o_id)
  186. 41 objects += [o]
  187. 42 # Wipe objects
  188. 43 from noc.lib.debug import error_report
  189. 44 for o in objects:
  190. 45 with self.log("Wiping '%s':" % unicode(o), True):
  191. 46 try:
  192. 47 ==> wiper(o)
  193. 48 except:
  194. 49 error_report()
  195. 50
  196. 51 @contextmanager
  197. 52 def log(self, message, newline=False):
  198. 53 """
  199. Variables:
  200. self = <noc.main.management.commands.wipe.Command object at 0x7ff726663750>
  201. args = ('managed_object', 'wiping-7')
  202. m = 'managed_object'
  203. o = <ManagedObject: wiping-7>
  204. options =
  205. {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
  206. objects = [<ManagedObject: wiping-7>]
  207. getter =
  208. <bound method Command.get_managed_object of <noc.main.management.commands.wipe.Command object at 0x7ff726663750>>
  209. error_report = <function error_report at 0x7ff73b2dcf50>
  210. wiper =
  211. <bound method Command.wipe_managed_object of <noc.main.management.commands.wipe.Command object at 0x7ff726663750>>
  212. o_id = 'wiping-7'
  213. ------------------------------------------------------------------------
  214. END OF TRACEBACK
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement