Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- root@noc:/opt/noc # ./noc wipe managed-object kstovo
- Wiping 'kstovo':
- Deleting new events ... done
- Deleting failed events ... done
- Deleting active events ... done
- Deleting archived events ... done
- Deleting alarms ... done
- Wiping MAC DB ... done
- Wiping pending link checks ... done
- Wiping discovered ids ... done
- Deleting forwarding instances, interfaces, subinterfaces and links ... done
- Unbinding from IPAM ... done
- Deleting map tasks ... done
- Deleting object's attributes ... done
- Deleting managed object and config ... ERROR:noc.lib.debug:UNHANDLED EXCEPTION (2014-10-30 10:46:14.055504)
- Working directory: /opt/noc
- <class 'django.db.utils.IntegrityError'>
- <ManagedObject: kstovo> object is referenced from <class 'sa.models.objectcapabilities.ObjectCapabilities'>
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: /opt/noc/lib/nosql.py (Line: 226)
- Function: on_ref_delete
- 219 :return:
- 220 """
- 221 if not self.name:
- 222 return
- 223 doc = self.owner_document
- 224 if doc.objects.filter(**{self.name: instance.id}).first() is not None:
- 225 raise IntegrityError("%r object is referenced from %r" % (instance,
- 226 ==> doc))
- 227
- 228 def __get__(self, instance, owner):
- 229 """Descriptor to allow lazy dereferencing."""
- 230 if instance is None:
- 231 # Document class being used rather than a document object
- 232 return self
- Variables:
- doc = <class 'sa.models.objectcapabilities.ObjectCapabilities'>
- self = <noc.lib.nosql.ForeignKeyField object at 0x80e120190>
- instance = <ManagedObject: kstovo>
- sender = <class 'noc.sa.models.managedobject.ManagedObject'>
- kwargs =
- {'signal': <django.dispatch.dispatcher.Signal object at 0x80a8c7450>,
- 'using': 'default'}
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/django/dispatch/dispatcher.py (Line: 172)
- Function: send
- 165 Returns a list of tuple pairs [(receiver, response), ... ].
- 166 """
- 167 responses = []
- 168 if not self.receivers:
- 169 return responses
- 170
- 171 for receiver in self._live_receivers(_make_id(sender)):
- 172 ==> response = receiver(signal=self, sender=sender, **named)
- 173 responses.append((receiver, response))
- 174 return responses
- 175
- 176 def send_robust(self, sender, **named):
- 177 """
- 178 Send signal from sender to all connected receivers catching errors.
- Variables:
- named = {'instance': <ManagedObject: kstovo>, 'using': 'default'}
- responses =
- [(<bound method ?.on_delete_model of <class 'noc.pm.models.probeconfig.ProbeConfig'>>,
- None),
- (<bound method ?.on_ref_delete of <noc.lib.nosql.ForeignKeyField object at 0x80dfe6590>>,
- None)]
- self = <django.dispatch.dispatcher.Signal object at 0x80a8c7450>
- receiver =
- <bound method ?.on_ref_delete of <noc.lib.nosql.ForeignKeyField object at 0x80e120190>>
- response = None
- sender = <class 'noc.sa.models.managedobject.ManagedObject'>
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/django/db/models/deletion.py (Line: 239)
- Function: delete
- 232 # end of a transaction.
- 233 self.sort()
- 234
- 235 # send pre_delete signals
- 236 for model, obj in self.instances_with_model():
- 237 if not model._meta.auto_created:
- 238 signals.pre_delete.send(
- 239 ==> sender=model, instance=obj, using=self.using
- 240 )
- 241
- 242 # update fields
- 243 for model, instances_for_fieldvalues in self.field_updates.iteritems():
- 244 query = sql.UpdateQuery(model)
- 245 for (field, value), instances in instances_for_fieldvalues.iteritems():
- Variables:
- instances = set([<ManagedObject: kstovo>])
- model = <class 'noc.sa.models.managedobject.ManagedObject'>
- obj = <ManagedObject: kstovo>
- self = <django.db.models.deletion.Collector object at 0x812ac4990>
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/django/db/models/deletion.py (Line: 61)
- Function: decorated
- 54 def decorated(self, *args, **kwargs):
- 55 if not transaction.is_managed(using=self.using):
- 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:
- Variables:
- self = <django.db.models.deletion.Collector object at 0x812ac4990>
- kwargs = {}
- func = <function delete at 0x80a8fd0c8>
- args = ()
- forced_managed = True
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/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: kstovo>
- collector = <django.db.models.deletion.Collector object at 0x812ac4990>
- ------------------------------------------------------------------------
- File: /opt/noc/sa/models/managedobject.py (Line: 301)
- Function: delete
- 294 ObjectMap.update_map(
- 295 self, self.collector, self.trap_source_ip)
- 296
- 297 def delete(self, *args, **kwargs):
- 298 # Deny to delete "SAE" object
- 299 if self.name == "SAE":
- 300 raise IntegrityError("Cannot delete SAE object")
- 301 ==> super(ManagedObject, self).delete(*args, **kwargs)
- 302
- 303 def sync_ipam(self):
- 304 """
- 305 Synchronize FQDN and address with IPAM
- 306 """
- 307 from noc.ip.models.address import Address
- Variables:
- self = <ManagedObject: kstovo>
- args = ()
- kwargs = {}
- ------------------------------------------------------------------------
- File: /opt/noc/main/management/commands/wipe.py (Line: 169)
- Function: wipe_managed_object
- 162 with self.log("Deleting map tasks"):
- 163 MapTask.objects.filter(managed_object=o).delete()
- 164 # Delete Managed Object's attributes
- 165 with self.log("Deleting object's attributes"):
- 166 ManagedObjectAttribute.objects.filter(managed_object=o).delete()
- 167 # Finally delete object and config
- 168 with self.log("Deleting managed object and config"):
- 169 ==> o.delete()
- 170
- 171 def get_user(self, u_id):
- 172 """
- 173 Get User by id or name
- 174 :param o_id: Object's id or name
- 175 :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.NewEvent'>
- ActiveEvent = <class 'noc.fm.models.activeevent.ActiveEvent'>
- o = <ManagedObject: kstovo>
- ArchivedEvent = <class 'noc.fm.models.archivedevent.ArchivedEvent'>
- self = <noc.main.management.commands.wipe.Command object at 0x8129f9ad0>
- 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.FailedEvent'>
- a = <Address: bca(4): 192.168.72.253>
- my_root = None
- i = <Interface: kstovo: As 1>
- MapTask = <class 'noc.sa.models.maptask.MapTask'>
- 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 0x8129f9ad0>
- args = ('managed-object', 'kstovo')
- m = 'managed_object'
- o = <ManagedObject: kstovo>
- options =
- {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
- objects = [<ManagedObject: kstovo>]
- getter =
- <bound method Command.get_managed_object of <noc.main.management.commands.wipe.Command object at 0x8129f9ad0>>
- error_report = <function error_report at 0x8063ee230>
- wiper =
- <bound method Command.wipe_managed_object of <noc.main.management.commands.wipe.Command object at 0x8129f9ad0>>
- o_id = 'kstovo'
- ------------------------------------------------------------------------
- END OF TRACEBACK
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement