Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - Deleting managed object and config ... ERROR:root:UNHANDLED EXCEPTION (2013-08-09 15:07:27.239215)
 - Working directory: /opt/noc
 - <class 'django.db.utils.IntegrityError'>
 - update or delete on table "sa_managedobject" violates foreign key constraint "managed_object_id_refs_id_682b6444661e6ca8" on table "sa_maptask"
 - DETAIL: Key (id)=(458) is still referenced from table "sa_maptask".
 - START OF TRACEBACK
 - ------------------------------------------------------------------------
 - File: /opt/noc/contrib/lib/django/db/backends/postgresql_psycopg2/base.py (Line: 235)
 - Function: _commit
 - 228 finally:
 - 229 self.isolation_level = level
 - 230 self.features.uses_savepoints = bool(level)
 - 231
 - 232 def _commit(self):
 - 233 if self.connection is not None:
 - 234 try:
 - 235 ==> return self.connection.commit()
 - 236 except Database.IntegrityError, e:
 - 237 raise utils.IntegrityError, utils.IntegrityError(*tuple(e)), sys.exc_info()[2]
 - Variables:
 - self =
 - <django.db.backends.postgresql_psycopg2.base.DatabaseWrapper object at 0x803ca8e10>
 - e =
 - 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',)
 - ------------------------------------------------------------------------
 - File: /opt/noc/contrib/lib/django/db/backends/__init__.py (Line: 223)
 - Function: commit
 - 216 self.set_dirty()
 - 217
 - 218 def commit(self):
 - 219 """
 - 220 Does the commit itself and resets the dirty flag.
 - 221 """
 - 222 self.validate_thread_sharing()
 - 223 ==> self._commit()
 - 224 self.set_clean()
 - 225
 - 226 def rollback(self):
 - 227 """
 - 228 This function does the rollback itself and resets the dirty flag.
 - 229 """
 - Variables:
 - self =
 - <django.db.backends.postgresql_psycopg2.base.DatabaseWrapper object at 0x803ca8e10>
 - ------------------------------------------------------------------------
 - File: /opt/noc/contrib/lib/django/db/transaction.py (Line: 138)
 - Function: commit
 - 131 def commit(using=None):
 - 132 """
 - 133 Does the commit itself and resets the dirty flag.
 - 134 """
 - 135 if using is None:
 - 136 using = DEFAULT_DB_ALIAS
 - 137 connection = connections[using]
 - 138 ==> connection.commit()
 - 139
 - 140 def rollback(using=None):
 - 141 """
 - 142 This function does the rollback itself and resets the dirty flag.
 - 143 """
 - 144 if using is None:
 - Variables:
 - using = 'default'
 - connection =
 - <django.db.backends.postgresql_psycopg2.base.DatabaseWrapper object at 0x803ca8e10>
 - ------------------------------------------------------------------------
 - File: /opt/noc/contrib/lib/django/db/models/deletion.py (Line: 63)
 - Function: decorated
 - 56 transaction.enter_transaction_management(using=self.using)
 - 57 forced_managed = True
 - 58 else:
 - 59 forced_managed = False
 - 60 try:
 - 61 func(self, *args, **kwargs)
 - 62 if forced_managed:
 - 63 ==> transaction.commit(using=self.using)
 - 64 else:
 - 65 transaction.commit_unless_managed(using=self.using)
 - 66 finally:
 - 67 if forced_managed:
 - 68 transaction.leave_transaction_management(using=self.using)
 - 69 return decorated
 - Variables:
 - self = <django.db.models.deletion.Collector object at 0x809ba3290>
 - kwargs = {}
 - func = <function delete at 0x804ac8aa0>
 - args = ()
 - forced_managed = True
 - ------------------------------------------------------------------------
 - File: /opt/noc/contrib/lib/django/db/models/base.py (Line: 576)
 - Function: delete
 - 569
 - 570 def delete(self, using=None):
 - 571 using = using or router.db_for_write(self.__class__, instance=self)
 - 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)
 - 573
 - 574 collector = Collector(using=using)
 - 575 collector.collect([self])
 - 576 ==> collector.delete()
 - 577
 - 578 delete.alters_data = True
 - 579
 - 580 def _get_FIELD_display(self, field):
 - 581 value = getattr(self, field.attname)
 - 582 return force_unicode(dict(field.flatchoices).get(value, value), strings_only=True)
 - Variables:
 - using = 'default'
 - self = <ManagedObject: bb->
 - collector = <django.db.models.deletion.Collector object at 0x809ba3290>
 - ------------------------------------------------------------------------
 - File: /opt/noc/sa/models/managedobject.py (Line: 271)
 - Function: delete
 - 264 if self.name == "SAE":
 - 265 raise IntegrityError("Cannot delete SAE object")
 - 266 try:
 - 267 if self.config.id:
 - 268 self.config.delete()
 - 269 except Config.DoesNotExist:
 - 270 pass
 - 271 ==> super(ManagedObject, self).delete()
 - 272
 - 273 def sync_ipam(self):
 - 274 """
 - 275 Synchronize FQDN and address with IPAM
 - 276 """
 - 277 from noc.ip.models.address import Address
 - Variables:
 - self = <ManagedObject: bb->
 - Config = <class 'noc.cm.models.Config'>
 - ------------------------------------------------------------------------
 - File: /opt/noc/main/management/commands/wipe.py (Line: 165)
 - Function: wipe_managed_object
 - 158 a.managed_object = None
 - 159 a.save()
 - 160 # Delete Managed Object's attributes
 - 161 with self.log("Deleting object's attributes"):
 - 162 ManagedObjectAttribute.objects.filter(managed_object=o).delete()
 - 163 # Finally delete object and config
 - 164 with self.log("Deleting managed object and config"):
 - 165 ==> o.delete()
 - 166
 - 167 def get_user(self, u_id):
 - 168 """
 - 169 Get User by id or name
 - 170 :param o_id: Object's id or name
 - 171 :return: ManagedObject
 - Variables:
 - ac = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
 - ActiveAlarm = <class 'noc.fm.models.activealarm.ActiveAlarm'>
 - MACDB = <class 'noc.inv.models.macdb.MACDB'>
 - iac = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
 - NewEvent = <class 'noc.fm.models.NewEvent'>
 - ia = <ArchivedAlarm: 51e64db6f3b68245ed0dc78e>
 - ActiveEvent = <class 'noc.fm.models.ActiveEvent'>
 - ArchivedEvent = <class 'noc.fm.models.ArchivedEvent'>
 - self = <noc.main.management.commands.wipe.Command object at 0x808f249d0>
 - DiscoveryID = <class 'noc.inv.models.discoveryid.DiscoveryID'>
 - ForwardingInstance = <class 'noc.inv.models.forwardinginstance.ForwardingInstance'>
 - Link = <class 'noc.inv.models.link.Link'>
 - Address = <class 'noc.ip.models.address.Address'>
 - Interface = <class 'noc.inv.models.interface.Interface'>
 - ManagedObjectAttribute = <class 'noc.sa.models.managedobject.ManagedObjectAttribute'>
 - ArchivedAlarm = <class 'noc.fm.models.archivedalarm.ArchivedAlarm'>
 - FailedEvent = <class 'noc.fm.models.FailedEvent'>
 - a = <Address: Global(4): 212.92.140.53>
 - my_root = None
 - i = <Interface: bb-: TenGigE1/1/1/3>
 - o = <ManagedObject: bb->
 - PendingLinkCheck = <class 'noc.inv.models.pendinglinkcheck.PendingLinkCheck'>
 - SubInterface = <class 'noc.inv.models.subinterface.SubInterface'>
 - ------------------------------------------------------------------------
 - File: /opt/noc/main/management/commands/wipe.py (Line: 47)
 - Function: handle
 - 40 raise CommandError("Object '%s' is not found" % o_id)
 - 41 objects += [o]
 - 42 # Wipe objects
 - 43 from noc.lib.debug import error_report
 - 44 for o in objects:
 - 45 with self.log("Wiping '%s':" % unicode(o), True):
 - 46 try:
 - 47 ==> wiper(o)
 - 48 except:
 - 49 error_report()
 - 50
 - 51 @contextmanager
 - 52 def log(self, message, newline=False):
 - 53 """
 - Variables:
 - self = <noc.main.management.commands.wipe.Command object at 0x808f249d0>
 - args = ('managed-object', 'bb-')
 - m = 'managed_object'
 - o = <ManagedObject: bb->
 - options =
 - {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
 - objects = [<ManagedObject: bb->]
 - getter =
 - <bound method Command.get_managed_object of <noc.main.management.commands.wipe.Command object at 0x808f249d0>>
 - error_report = <function error_report at 0x8038b0c80>
 - wiper =
 - <bound method Command.wipe_managed_object of <noc.main.management.commands.wipe.Command object at 0x808f249d0>>
 - o_id = 'bb-'
 - ------------------------------------------------------------------------
 - END OF TRACEBACK
 - done
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment