Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [root@noc noc]# ./noc wipe user admin
- Wiping 'admin':
- Cleaning user preferences ... done
- Cleaning audit trail ... ERROR:noc.lib.debug:UNHANDLED EXCEPTION (2014-12-30 16:41:30.344066)
- Working directory: /opt/noc
- <class 'bson.errors.InvalidDocument'>
- Cannot encode object: <User: admin>
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/pymongo/collection.py (Line: 672)
- Function: remove
- 665 if options:
- 666 command['writeConcern'] = options
- 667
- 668 docs = [SON([('q', spec_or_id), ('limit', int(not multi))])]
- 669
- 670 results = message._do_batched_write_command(
- 671 self.database.name + '.$cmd', _DELETE, command,
- 672 ==> docs, False, self.uuid_subtype, client)
- 673 _check_write_command_response(results)
- 674
- 675 _, result = results[0]
- 676 return result
- 677
- 678 else:
- Variables:
- multi = True
- docs = [SON([('q', {'user': <User: admin>}), ('limit', 0)])]
- self =
- Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.audittrail')
- safe = True
- spec_or_id = {'user': <User: admin>}
- client = MongoClient('localhost', 27017)
- command =
- SON([('delete', u'noc.audittrail'), ('writeConcern', {'write_concern': {}})])
- kwargs = {'write_concern': {}}
- options = {'write_concern': {}}
- ------------------------------------------------------------------------
- File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 402)
- Function: delete
- 395 document_cls.objects(**{field_name + '__in': self}).update(
- 396 write_concern=write_concern, **{'unset__%s' % field_name: 1})
- 397 elif rule == PULL:
- 398 document_cls.objects(**{field_name + '__in': self}).update(
- 399 write_concern=write_concern,
- 400 **{'pull_all__%s' % field_name: self})
- 401
- 402 ==> queryset._collection.remove(queryset._query, write_concern=write_concern)
- 403
- 404 def update(self, upsert=False, multi=True, write_concern=None,
- 405 full_result=False, **update):
- 406 """Perform an atomic update on the fields matched by the query.
- 407
- 408 :param upsert: Any existing document with that "_id" is overwritten.
- Variables:
- doc = <class 'noc.main.models.audittrail.AuditTrail'>
- self = repr() failed
- queryset = repr() failed
- has_delete_signal = False
- _from_doc_delete = False
- delete_rules = {}
- call_document_delete = False
- write_concern = {}
- ------------------------------------------------------------------------
- File: /opt/noc/main/management/commands/wipe.py (Line: 214)
- Function: wipe_user
- 207 from noc.ip.models import PrefixAccess, PrefixBookmark
- 208 from noc.kb.models import KBEntryPreviewLog, KBUserBookmark
- 209 # Clean UserState
- 210 with self.log("Cleaning user preferences"):
- 211 UserState.objects.filter(user_id=o.id).delete()
- 212 # Clean NotificationGroupUser
- 213 with self.log("Cleaning audit trail"):
- 214 ==> AuditTrail.objects.filter(user=o).delete()
- 215 # Clean NotificationGroupUser
- 216 with self.log("Cleaning notification groups"):
- 217 NotificationGroupUser.objects.filter(user=o).delete()
- 218 # Clean User profile
- 219 with self.log("Cleaning user profile"):
- 220 UserProfile.objects.filter(user=o).delete()
- Variables:
- o = <User: admin>
- PrefixBookmark = <class 'noc.ip.models.prefixbookmark.PrefixBookmark'>
- KBUserBookmark = <class 'noc.kb.models.KBUserBookmark'>
- UserState = <class 'noc.main.models.UserState'>
- NotificationGroupUser = <class 'noc.main.models.notificationgroup.NotificationGroupUser'>
- self = <noc.main.management.commands.wipe.Command object at 0x6918850>
- PrefixAccess = <class 'noc.ip.models.prefixaccess.PrefixAccess'>
- Checkpoint = <class 'noc.main.models.Checkpoint'>
- KBEntryPreviewLog = <class 'noc.kb.models.KBEntryPreviewLog'>
- ActiveAlarm = <class 'noc.fm.models.activealarm.ActiveAlarm'>
- UserAccess = <class 'noc.sa.models.useraccess.UserAccess'>
- AuditTrail = <class 'noc.main.models.audittrail.AuditTrail'>
- UserProfile = <class 'noc.main.models.userprofile.UserProfile'>
- ------------------------------------------------------------------------
- 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 0x6918850>
- args = ('user', 'admin')
- m = 'user'
- o = <User: admin>
- options =
- {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
- objects = [<User: admin>]
- getter =
- <bound method Command.get_user of <noc.main.management.commands.wipe.Command object at 0x6918850>>
- error_report = <function error_report at 0x2c40320>
- wiper =
- <bound method Command.wipe_user of <noc.main.management.commands.wipe.Command object at 0x6918850>>
- o_id = 'admin'
- ------------------------------------------------------------------------
- END OF TRACEBACK
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement