Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.63 KB | None | 0 0
  1. root@noc:/opt/noc # ./noc wipe managed-object kstovo
  2. Wiping 'kstovo':
  3. Deleting new events ... done
  4. Deleting failed events ... done
  5. Deleting active events ... done
  6. Deleting archived events ... done
  7. Deleting alarms ... done
  8. Wiping MAC DB ... done
  9. Wiping pending link checks ... done
  10. Wiping discovered ids ... done
  11. Deleting forwarding instances, interfaces, subinterfaces and links ... done
  12. Unbinding from IPAM ... done
  13. Deleting map tasks ... done
  14. Deleting object's attributes ... done
  15. Deleting managed object and config ... ERROR:noc.lib.debug:UNHANDLED EXCEPTION (2014-10-30 10:46:14.055504)
  16. Working directory: /opt/noc
  17. <class 'django.db.utils.IntegrityError'>
  18. <ManagedObject: kstovo> object is referenced from <class 'sa.models.objectcapabilities.ObjectCapabilities'>
  19. START OF TRACEBACK
  20. ------------------------------------------------------------------------
  21. File: /opt/noc/lib/nosql.py (Line: 226)
  22. Function: on_ref_delete
  23. 219 :return:
  24. 220 """
  25. 221 if not self.name:
  26. 222 return
  27. 223 doc = self.owner_document
  28. 224 if doc.objects.filter(**{self.name: instance.id}).first() is not None:
  29. 225 raise IntegrityError("%r object is referenced from %r" % (instance,
  30. 226 ==> doc))
  31. 227
  32. 228 def __get__(self, instance, owner):
  33. 229 """Descriptor to allow lazy dereferencing."""
  34. 230 if instance is None:
  35. 231 # Document class being used rather than a document object
  36. 232 return self
  37. Variables:
  38. doc = <class 'sa.models.objectcapabilities.ObjectCapabilities'>
  39. self = <noc.lib.nosql.ForeignKeyField object at 0x80e120190>
  40. instance = <ManagedObject: kstovo>
  41. sender = <class 'noc.sa.models.managedobject.ManagedObject'>
  42. kwargs =
  43. {'signal': <django.dispatch.dispatcher.Signal object at 0x80a8c7450>,
  44. 'using': 'default'}
  45. ------------------------------------------------------------------------
  46. File: /opt/noc/lib/python2.7/site-packages/django/dispatch/dispatcher.py (Line: 172)
  47. Function: send
  48. 165 Returns a list of tuple pairs [(receiver, response), ... ].
  49. 166 """
  50. 167 responses = []
  51. 168 if not self.receivers:
  52. 169 return responses
  53. 170
  54. 171 for receiver in self._live_receivers(_make_id(sender)):
  55. 172 ==> response = receiver(signal=self, sender=sender, **named)
  56. 173 responses.append((receiver, response))
  57. 174 return responses
  58. 175
  59. 176 def send_robust(self, sender, **named):
  60. 177 """
  61. 178 Send signal from sender to all connected receivers catching errors.
  62. Variables:
  63. named = {'instance': <ManagedObject: kstovo>, 'using': 'default'}
  64. responses =
  65. [(<bound method ?.on_delete_model of <class 'noc.pm.models.probeconfig.ProbeConfig'>>,
  66. None),
  67. (<bound method ?.on_ref_delete of <noc.lib.nosql.ForeignKeyField object at 0x80dfe6590>>,
  68. None)]
  69. self = <django.dispatch.dispatcher.Signal object at 0x80a8c7450>
  70. receiver =
  71. <bound method ?.on_ref_delete of <noc.lib.nosql.ForeignKeyField object at 0x80e120190>>
  72. response = None
  73. sender = <class 'noc.sa.models.managedobject.ManagedObject'>
  74. ------------------------------------------------------------------------
  75. File: /opt/noc/lib/python2.7/site-packages/django/db/models/deletion.py (Line: 239)
  76. Function: delete
  77. 232 # end of a transaction.
  78. 233 self.sort()
  79. 234
  80. 235 # send pre_delete signals
  81. 236 for model, obj in self.instances_with_model():
  82. 237 if not model._meta.auto_created:
  83. 238 signals.pre_delete.send(
  84. 239 ==> sender=model, instance=obj, using=self.using
  85. 240 )
  86. 241
  87. 242 # update fields
  88. 243 for model, instances_for_fieldvalues in self.field_updates.iteritems():
  89. 244 query = sql.UpdateQuery(model)
  90. 245 for (field, value), instances in instances_for_fieldvalues.iteritems():
  91. Variables:
  92. instances = set([<ManagedObject: kstovo>])
  93. model = <class 'noc.sa.models.managedobject.ManagedObject'>
  94. obj = <ManagedObject: kstovo>
  95. self = <django.db.models.deletion.Collector object at 0x812ac4990>
  96. ------------------------------------------------------------------------
  97. File: /opt/noc/lib/python2.7/site-packages/django/db/models/deletion.py (Line: 61)
  98. Function: decorated
  99. 54 def decorated(self, *args, **kwargs):
  100. 55 if not transaction.is_managed(using=self.using):
  101. 56 transaction.enter_transaction_management(using=self.using)
  102. 57 forced_managed = True
  103. 58 else:
  104. 59 forced_managed = False
  105. 60 try:
  106. 61 ==> func(self, *args, **kwargs)
  107. 62 if forced_managed:
  108. 63 transaction.commit(using=self.using)
  109. 64 else:
  110. 65 transaction.commit_unless_managed(using=self.using)
  111. 66 finally:
  112. 67 if forced_managed:
  113. Variables:
  114. self = <django.db.models.deletion.Collector object at 0x812ac4990>
  115. kwargs = {}
  116. func = <function delete at 0x80a8fd0c8>
  117. args = ()
  118. forced_managed = True
  119. ------------------------------------------------------------------------
  120. File: /opt/noc/lib/python2.7/site-packages/django/db/models/base.py (Line: 576)
  121. Function: delete
  122. 569
  123. 570 def delete(self, using=None):
  124. 571 using = using or router.db_for_write(self.__class__, instance=self)
  125. 572 assert self._get_pk_val() is not None, "%s object can't be deleted because its %s attribute is set to None." % (self._meta.object_name, self._meta.pk.attname)
  126. 573
  127. 574 collector = Collector(using=using)
  128. 575 collector.collect([self])
  129. 576 ==> collector.delete()
  130. 577
  131. 578 delete.alters_data = True
  132. 579
  133. 580 def _get_FIELD_display(self, field):
  134. 581 value = getattr(self, field.attname)
  135. 582 return force_unicode(dict(field.flatchoices).get(value, value), strings_only=True)
  136. Variables:
  137. using = 'default'
  138. self = <ManagedObject: kstovo>
  139. collector = <django.db.models.deletion.Collector object at 0x812ac4990>
  140. ------------------------------------------------------------------------
  141. File: /opt/noc/sa/models/managedobject.py (Line: 301)
  142. Function: delete
  143. 294 ObjectMap.update_map(
  144. 295 self, self.collector, self.trap_source_ip)
  145. 296
  146. 297 def delete(self, *args, **kwargs):
  147. 298 # Deny to delete "SAE" object
  148. 299 if self.name == "SAE":
  149. 300 raise IntegrityError("Cannot delete SAE object")
  150. 301 ==> super(ManagedObject, self).delete(*args, **kwargs)
  151. 302
  152. 303 def sync_ipam(self):
  153. 304 """
  154. 305 Synchronize FQDN and address with IPAM
  155. 306 """
  156. 307 from noc.ip.models.address import Address
  157. Variables:
  158. self = <ManagedObject: kstovo>
  159. args = ()
  160. kwargs = {}
  161. ------------------------------------------------------------------------
  162. File: /opt/noc/main/management/commands/wipe.py (Line: 169)
  163. Function: wipe_managed_object
  164. 162 with self.log("Deleting map tasks"):
  165. 163 MapTask.objects.filter(managed_object=o).delete()
  166. 164 # Delete Managed Object's attributes
  167. 165 with self.log("Deleting object's attributes"):
  168. 166 ManagedObjectAttribute.objects.filter(managed_object=o).delete()
  169. 167 # Finally delete object and config
  170. 168 with self.log("Deleting managed object and config"):
  171. 169 ==> o.delete()
  172. 170
  173. 171 def get_user(self, u_id):
  174. 172 """
  175. 173 Get User by id or name
  176. 174 :param o_id: Object's id or name
  177. 175 :return: ManagedObject
  178. Variables:
  179. ac = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  180. ActiveAlarm = <class 'noc.fm.models.activealarm.ActiveAlarm'>
  181. MACDB = <class 'noc.inv.models.macdb.MACDB'>
  182. iac = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  183. NewEvent = <class 'noc.fm.models.newevent.NewEvent'>
  184. ActiveEvent = <class 'noc.fm.models.activeevent.ActiveEvent'>
  185. o = <ManagedObject: kstovo>
  186. ArchivedEvent = <class 'noc.fm.models.archivedevent.ArchivedEvent'>
  187. self = <noc.main.management.commands.wipe.Command object at 0x8129f9ad0>
  188. DiscoveryID = <class 'noc.inv.models.discoveryid.DiscoveryID'>
  189. ForwardingInstance = <class 'noc.inv.models.forwardinginstance.ForwardingInstance'>
  190. Link = <class 'noc.inv.models.link.Link'>
  191. Address = <class 'noc.ip.models.address.Address'>
  192. Interface = <class 'noc.inv.models.interface.Interface'>
  193. ManagedObjectAttribute = <class 'noc.sa.models.managedobject.ManagedObjectAttribute'>
  194. ArchivedAlarm = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  195. FailedEvent = <class 'noc.fm.models.failedevent.FailedEvent'>
  196. a = <Address: bca(4): 192.168.72.253>
  197. my_root = None
  198. i = <Interface: kstovo: As 1>
  199. MapTask = <class 'noc.sa.models.maptask.MapTask'>
  200. PendingLinkCheck = <class 'noc.inv.models.pendinglinkcheck.PendingLinkCheck'>
  201. SubInterface = <class 'noc.inv.models.subinterface.SubInterface'>
  202. ------------------------------------------------------------------------
  203. File: /opt/noc/main/management/commands/wipe.py (Line: 47)
  204. Function: handle
  205. 40 raise CommandError("Object '%s' is not found" % o_id)
  206. 41 objects += [o]
  207. 42 # Wipe objects
  208. 43 from noc.lib.debug import error_report
  209. 44 for o in objects:
  210. 45 with self.log("Wiping '%s':" % unicode(o), True):
  211. 46 try:
  212. 47 ==> wiper(o)
  213. 48 except:
  214. 49 error_report()
  215. 50
  216. 51 @contextmanager
  217. 52 def log(self, message, newline=False):
  218. 53 """
  219. Variables:
  220. self = <noc.main.management.commands.wipe.Command object at 0x8129f9ad0>
  221. args = ('managed-object', 'kstovo')
  222. m = 'managed_object'
  223. o = <ManagedObject: kstovo>
  224. options =
  225. {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
  226. objects = [<ManagedObject: kstovo>]
  227. getter =
  228. <bound method Command.get_managed_object of <noc.main.management.commands.wipe.Command object at 0x8129f9ad0>>
  229. error_report = <function error_report at 0x8063ee230>
  230. wiper =
  231. <bound method Command.wipe_managed_object of <noc.main.management.commands.wipe.Command object at 0x8129f9ad0>>
  232. o_id = 'kstovo'
  233. ------------------------------------------------------------------------
  234. END OF TRACEBACK
  235. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement