Advertisement
Guest User

Untitled

a guest
Aug 9th, 2013
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.81 KB | None | 0 0
  1. Deleting managed object and config ... ERROR:root:UNHANDLED EXCEPTION (2013-08-09 15:07:27.239215)
  2. Working directory: /opt/noc
  3. <class 'django.db.utils.IntegrityError'>
  4. update or delete on table "sa_managedobject" violates foreign key constraint "managed_object_id_refs_id_682b6444661e6ca8" on table "sa_maptask"
  5. DETAIL: Key (id)=(458) is still referenced from table "sa_maptask".
  6.  
  7. START OF TRACEBACK
  8. ------------------------------------------------------------------------
  9. File: /opt/noc/contrib/lib/django/db/backends/postgresql_psycopg2/base.py (Line: 235)
  10. Function: _commit
  11. 228 finally:
  12. 229 self.isolation_level = level
  13. 230 self.features.uses_savepoints = bool(level)
  14. 231
  15. 232 def _commit(self):
  16. 233 if self.connection is not None:
  17. 234 try:
  18. 235 ==> return self.connection.commit()
  19. 236 except Database.IntegrityError, e:
  20. 237 raise utils.IntegrityError, utils.IntegrityError(*tuple(e)), sys.exc_info()[2]
  21. Variables:
  22. self =
  23. <django.db.backends.postgresql_psycopg2.base.DatabaseWrapper object at 0x803ca8e10>
  24. e =
  25. IntegrityError('update or delete on table "sa_managedobject" violates foreign key constraint "managed_object_id_refs_id_682b6444661e6ca8" on table "sa_maptask"\nDETAIL: Key (id)=(458) is still referenced from table "sa_maptask".\n',)
  26. ------------------------------------------------------------------------
  27. File: /opt/noc/contrib/lib/django/db/backends/__init__.py (Line: 223)
  28. Function: commit
  29. 216 self.set_dirty()
  30. 217
  31. 218 def commit(self):
  32. 219 """
  33. 220 Does the commit itself and resets the dirty flag.
  34. 221 """
  35. 222 self.validate_thread_sharing()
  36. 223 ==> self._commit()
  37. 224 self.set_clean()
  38. 225
  39. 226 def rollback(self):
  40. 227 """
  41. 228 This function does the rollback itself and resets the dirty flag.
  42. 229 """
  43. Variables:
  44. self =
  45. <django.db.backends.postgresql_psycopg2.base.DatabaseWrapper object at 0x803ca8e10>
  46. ------------------------------------------------------------------------
  47. File: /opt/noc/contrib/lib/django/db/transaction.py (Line: 138)
  48. Function: commit
  49. 131 def commit(using=None):
  50. 132 """
  51. 133 Does the commit itself and resets the dirty flag.
  52. 134 """
  53. 135 if using is None:
  54. 136 using = DEFAULT_DB_ALIAS
  55. 137 connection = connections[using]
  56. 138 ==> connection.commit()
  57. 139
  58. 140 def rollback(using=None):
  59. 141 """
  60. 142 This function does the rollback itself and resets the dirty flag.
  61. 143 """
  62. 144 if using is None:
  63. Variables:
  64. using = 'default'
  65. connection =
  66. <django.db.backends.postgresql_psycopg2.base.DatabaseWrapper object at 0x803ca8e10>
  67. ------------------------------------------------------------------------
  68. File: /opt/noc/contrib/lib/django/db/models/deletion.py (Line: 63)
  69. Function: decorated
  70. 56 transaction.enter_transaction_management(using=self.using)
  71. 57 forced_managed = True
  72. 58 else:
  73. 59 forced_managed = False
  74. 60 try:
  75. 61 func(self, *args, **kwargs)
  76. 62 if forced_managed:
  77. 63 ==> transaction.commit(using=self.using)
  78. 64 else:
  79. 65 transaction.commit_unless_managed(using=self.using)
  80. 66 finally:
  81. 67 if forced_managed:
  82. 68 transaction.leave_transaction_management(using=self.using)
  83. 69 return decorated
  84. Variables:
  85. self = <django.db.models.deletion.Collector object at 0x809ba3290>
  86. kwargs = {}
  87. func = <function delete at 0x804ac8aa0>
  88. args = ()
  89. forced_managed = True
  90. ------------------------------------------------------------------------
  91. File: /opt/noc/contrib/lib/django/db/models/base.py (Line: 576)
  92. Function: delete
  93. 569
  94. 570 def delete(self, using=None):
  95. 571 using = using or router.db_for_write(self.__class__, instance=self)
  96. 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)
  97. 573
  98. 574 collector = Collector(using=using)
  99. 575 collector.collect([self])
  100. 576 ==> collector.delete()
  101. 577
  102. 578 delete.alters_data = True
  103. 579
  104. 580 def _get_FIELD_display(self, field):
  105. 581 value = getattr(self, field.attname)
  106. 582 return force_unicode(dict(field.flatchoices).get(value, value), strings_only=True)
  107. Variables:
  108. using = 'default'
  109. self = <ManagedObject: bb->
  110. collector = <django.db.models.deletion.Collector object at 0x809ba3290>
  111. ------------------------------------------------------------------------
  112. File: /opt/noc/sa/models/managedobject.py (Line: 271)
  113. Function: delete
  114. 264 if self.name == "SAE":
  115. 265 raise IntegrityError("Cannot delete SAE object")
  116. 266 try:
  117. 267 if self.config.id:
  118. 268 self.config.delete()
  119. 269 except Config.DoesNotExist:
  120. 270 pass
  121. 271 ==> super(ManagedObject, self).delete()
  122. 272
  123. 273 def sync_ipam(self):
  124. 274 """
  125. 275 Synchronize FQDN and address with IPAM
  126. 276 """
  127. 277 from noc.ip.models.address import Address
  128. Variables:
  129. self = <ManagedObject: bb->
  130. Config = <class 'noc.cm.models.Config'>
  131. ------------------------------------------------------------------------
  132. File: /opt/noc/main/management/commands/wipe.py (Line: 165)
  133. Function: wipe_managed_object
  134. 158 a.managed_object = None
  135. 159 a.save()
  136. 160 # Delete Managed Object's attributes
  137. 161 with self.log("Deleting object's attributes"):
  138. 162 ManagedObjectAttribute.objects.filter(managed_object=o).delete()
  139. 163 # Finally delete object and config
  140. 164 with self.log("Deleting managed object and config"):
  141. 165 ==> o.delete()
  142. 166
  143. 167 def get_user(self, u_id):
  144. 168 """
  145. 169 Get User by id or name
  146. 170 :param o_id: Object's id or name
  147. 171 :return: ManagedObject
  148. Variables:
  149. ac = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  150. ActiveAlarm = <class 'noc.fm.models.activealarm.ActiveAlarm'>
  151. MACDB = <class 'noc.inv.models.macdb.MACDB'>
  152. iac = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  153. NewEvent = <class 'noc.fm.models.NewEvent'>
  154. ia = <ArchivedAlarm: 51e64db6f3b68245ed0dc78e>
  155. ActiveEvent = <class 'noc.fm.models.ActiveEvent'>
  156. ArchivedEvent = <class 'noc.fm.models.ArchivedEvent'>
  157. self = <noc.main.management.commands.wipe.Command object at 0x808f249d0>
  158. DiscoveryID = <class 'noc.inv.models.discoveryid.DiscoveryID'>
  159. ForwardingInstance = <class 'noc.inv.models.forwardinginstance.ForwardingInstance'>
  160. Link = <class 'noc.inv.models.link.Link'>
  161. Address = <class 'noc.ip.models.address.Address'>
  162. Interface = <class 'noc.inv.models.interface.Interface'>
  163. ManagedObjectAttribute = <class 'noc.sa.models.managedobject.ManagedObjectAttribute'>
  164. ArchivedAlarm = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
  165. FailedEvent = <class 'noc.fm.models.FailedEvent'>
  166. a = <Address: Global(4): 212.92.140.53>
  167. my_root = None
  168. i = <Interface: bb-: TenGigE1/1/1/3>
  169. o = <ManagedObject: bb->
  170. PendingLinkCheck = <class 'noc.inv.models.pendinglinkcheck.PendingLinkCheck'>
  171. SubInterface = <class 'noc.inv.models.subinterface.SubInterface'>
  172. ------------------------------------------------------------------------
  173. File: /opt/noc/main/management/commands/wipe.py (Line: 47)
  174. Function: handle
  175. 40 raise CommandError("Object '%s' is not found" % o_id)
  176. 41 objects += [o]
  177. 42 # Wipe objects
  178. 43 from noc.lib.debug import error_report
  179. 44 for o in objects:
  180. 45 with self.log("Wiping '%s':" % unicode(o), True):
  181. 46 try:
  182. 47 ==> wiper(o)
  183. 48 except:
  184. 49 error_report()
  185. 50
  186. 51 @contextmanager
  187. 52 def log(self, message, newline=False):
  188. 53 """
  189. Variables:
  190. self = <noc.main.management.commands.wipe.Command object at 0x808f249d0>
  191. args = ('managed-object', 'bb-')
  192. m = 'managed_object'
  193. o = <ManagedObject: bb->
  194. options =
  195. {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
  196. objects = [<ManagedObject: bb->]
  197. getter =
  198. <bound method Command.get_managed_object of <noc.main.management.commands.wipe.Command object at 0x808f249d0>>
  199. error_report = <function error_report at 0x8038b0c80>
  200. wiper =
  201. <bound method Command.wipe_managed_object of <noc.main.management.commands.wipe.Command object at 0x808f249d0>>
  202. o_id = 'bb-'
  203. ------------------------------------------------------------------------
  204. END OF TRACEBACK
  205. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement