Advertisement
Guest User

Untitled

a guest
Dec 30th, 2014
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.33 KB | None | 0 0
  1. [root@noc noc]# ./noc wipe user admin
  2. Wiping 'admin':
  3. Cleaning user preferences ... done
  4. Cleaning audit trail ... ERROR:noc.lib.debug:UNHANDLED EXCEPTION (2014-12-30 16:41:30.344066)
  5. Working directory: /opt/noc
  6. <class 'bson.errors.InvalidDocument'>
  7. Cannot encode object: <User: admin>
  8. START OF TRACEBACK
  9. ------------------------------------------------------------------------
  10. File: /opt/noc/lib/python2.7/site-packages/pymongo/collection.py (Line: 672)
  11. Function: remove
  12. 665 if options:
  13. 666 command['writeConcern'] = options
  14. 667
  15. 668 docs = [SON([('q', spec_or_id), ('limit', int(not multi))])]
  16. 669
  17. 670 results = message._do_batched_write_command(
  18. 671 self.database.name + '.$cmd', _DELETE, command,
  19. 672 ==> docs, False, self.uuid_subtype, client)
  20. 673 _check_write_command_response(results)
  21. 674
  22. 675 _, result = results[0]
  23. 676 return result
  24. 677
  25. 678 else:
  26. Variables:
  27. multi = True
  28. docs = [SON([('q', {'user': <User: admin>}), ('limit', 0)])]
  29. self =
  30. Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.audittrail')
  31. safe = True
  32. spec_or_id = {'user': <User: admin>}
  33. client = MongoClient('localhost', 27017)
  34. command =
  35. SON([('delete', u'noc.audittrail'), ('writeConcern', {'write_concern': {}})])
  36. kwargs = {'write_concern': {}}
  37. options = {'write_concern': {}}
  38. ------------------------------------------------------------------------
  39. File: /opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 402)
  40. Function: delete
  41. 395 document_cls.objects(**{field_name + '__in': self}).update(
  42. 396 write_concern=write_concern, **{'unset__%s' % field_name: 1})
  43. 397 elif rule == PULL:
  44. 398 document_cls.objects(**{field_name + '__in': self}).update(
  45. 399 write_concern=write_concern,
  46. 400 **{'pull_all__%s' % field_name: self})
  47. 401
  48. 402 ==> queryset._collection.remove(queryset._query, write_concern=write_concern)
  49. 403
  50. 404 def update(self, upsert=False, multi=True, write_concern=None,
  51. 405 full_result=False, **update):
  52. 406 """Perform an atomic update on the fields matched by the query.
  53. 407
  54. 408 :param upsert: Any existing document with that "_id" is overwritten.
  55. Variables:
  56. doc = <class 'noc.main.models.audittrail.AuditTrail'>
  57. self = repr() failed
  58. queryset = repr() failed
  59. has_delete_signal = False
  60. _from_doc_delete = False
  61. delete_rules = {}
  62. call_document_delete = False
  63. write_concern = {}
  64. ------------------------------------------------------------------------
  65. File: /opt/noc/main/management/commands/wipe.py (Line: 214)
  66. Function: wipe_user
  67. 207 from noc.ip.models import PrefixAccess, PrefixBookmark
  68. 208 from noc.kb.models import KBEntryPreviewLog, KBUserBookmark
  69. 209 # Clean UserState
  70. 210 with self.log("Cleaning user preferences"):
  71. 211 UserState.objects.filter(user_id=o.id).delete()
  72. 212 # Clean NotificationGroupUser
  73. 213 with self.log("Cleaning audit trail"):
  74. 214 ==> AuditTrail.objects.filter(user=o).delete()
  75. 215 # Clean NotificationGroupUser
  76. 216 with self.log("Cleaning notification groups"):
  77. 217 NotificationGroupUser.objects.filter(user=o).delete()
  78. 218 # Clean User profile
  79. 219 with self.log("Cleaning user profile"):
  80. 220 UserProfile.objects.filter(user=o).delete()
  81. Variables:
  82. o = <User: admin>
  83. PrefixBookmark = <class 'noc.ip.models.prefixbookmark.PrefixBookmark'>
  84. KBUserBookmark = <class 'noc.kb.models.KBUserBookmark'>
  85. UserState = <class 'noc.main.models.UserState'>
  86. NotificationGroupUser = <class 'noc.main.models.notificationgroup.NotificationGroupUser'>
  87. self = <noc.main.management.commands.wipe.Command object at 0x6918850>
  88. PrefixAccess = <class 'noc.ip.models.prefixaccess.PrefixAccess'>
  89. Checkpoint = <class 'noc.main.models.Checkpoint'>
  90. KBEntryPreviewLog = <class 'noc.kb.models.KBEntryPreviewLog'>
  91. ActiveAlarm = <class 'noc.fm.models.activealarm.ActiveAlarm'>
  92. UserAccess = <class 'noc.sa.models.useraccess.UserAccess'>
  93. AuditTrail = <class 'noc.main.models.audittrail.AuditTrail'>
  94. UserProfile = <class 'noc.main.models.userprofile.UserProfile'>
  95. ------------------------------------------------------------------------
  96. File: /opt/noc/main/management/commands/wipe.py (Line: 47)
  97. Function: handle
  98. 40 raise CommandError("Object '%s' is not found" % o_id)
  99. 41 objects += [o]
  100. 42 # Wipe objects
  101. 43 from noc.lib.debug import error_report
  102. 44 for o in objects:
  103. 45 with self.log("Wiping '%s':" % unicode(o), True):
  104. 46 try:
  105. 47 ==> wiper(o)
  106. 48 except:
  107. 49 error_report()
  108. 50
  109. 51 @contextmanager
  110. 52 def log(self, message, newline=False):
  111. 53 """
  112. Variables:
  113. self = <noc.main.management.commands.wipe.Command object at 0x6918850>
  114. args = ('user', 'admin')
  115. m = 'user'
  116. o = <User: admin>
  117. options =
  118. {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
  119. objects = [<User: admin>]
  120. getter =
  121. <bound method Command.get_user of <noc.main.management.commands.wipe.Command object at 0x6918850>>
  122. error_report = <function error_report at 0x2c40320>
  123. wiper =
  124. <bound method Command.wipe_user of <noc.main.management.commands.wipe.Command object at 0x6918850>>
  125. o_id = 'admin'
  126. ------------------------------------------------------------------------
  127. END OF TRACEBACK
  128. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement