Advertisement
Guest User

Untitled

a guest
Apr 9th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.44 KB | None | 0 0
  1. Synchronize collections
  2. ERROR:noc.lib.debug:UNHANDLED EXCEPTION (2015-04-09 09:43:39.995428)
  3. BRANCH: None TIP: None
  4. PROCESS: manage.py
  5. ERROR FINGERPRINT: 81a9bbad-f825-5ad3-bf1e-b9b0ae9f29b2
  6. WORKING DIRECTORY: /usr/local/noc
  7. EXCEPTION: <class 'mongoengine.errors.FieldDoesNotExist'> The field 'is_builtin' does not exist on the document 'OIDAlias'
  8. START OF TRACEBACK
  9. ------------------------------------------------------------------------
  10. File: lib/python2.7/site-packages/mongoengine/base/document.py (Line: 81)
  11. Function: __init__
  12. 74 # Exception.
  13. 75 if not self._dynamic:
  14. 76 for var in values.keys():
  15. 77 if var not in self._fields.keys() + ['id', 'pk', '_cls', '_text_score']:
  16. 78 msg = (
  17. 79 "The field '{0}' does not exist on the document '{1}'"
  18. 80 ).format(var, self._class_name)
  19. 81 ==> raise FieldDoesNotExist(msg)
  20. 82
  21. 83 if self.STRICT and not self._dynamic:
  22. 84 self._data = StrictDict.create(allowed_keys=self._fields_ordered)()
  23. 85 else:
  24. 86 self._data = SemiStrictDict.create(
  25. 87 allowed_keys=self._fields_ordered)()
  26. Variables:
  27. self = repr() failed
  28. args = ()
  29. var = u'is_builtin'
  30. values =
  31. {'id': ObjectId('4eeb5058bcf4b106a3000099'),
  32. u'is_builtin': True,
  33. u'rewrite_oid': u'1.3.6.1.4.1.259.8.1.5',
  34. u'to_oid': u'1.3.6.1.4.1.259.6.10.94',
  35. u'uuid': UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')}
  36. _BaseDocument__auto_convert = False
  37. msg = "The field 'is_builtin' does not exist on the document 'OIDAlias'"
  38. _created = False
  39. _BaseDocument__only_fields = set([])
  40. ------------------------------------------------------------------------
  41. File: lib/python2.7/site-packages/mongoengine/base/document.py (Line: 709)
  42. Function: _from_son
  43. 702 msg = ("Invalid data to create a `%s` instance.\n%s"
  44. 703 % (cls._class_name, errors))
  45. 704 raise InvalidDocumentError(msg)
  46. 705
  47. 706 if cls.STRICT:
  48. 707 data = dict((k, v)
  49. 708 for k, v in data.iteritems() if k in cls._fields)
  50. 709 ==> obj = cls(__auto_convert=False, _created=created, __only_fields=only_fields, **data)
  51. 710 obj._changed_fields = changed_fields
  52. 711 if not _auto_dereference:
  53. 712 obj._fields = fields
  54. 713
  55. 714 return obj
  56. 715
  57. Variables:
  58. only_fields = []
  59. changed_fields = []
  60. created = False
  61. class_name = 'OIDAlias'
  62. fields =
  63. {'description': <mongoengine.fields.StringField object at 0x80a2c6090>,
  64. 'id': <mongoengine.base.fields.ObjectIdField object at 0x80a2c6150>,
  65. 'rewrite_oid': <mongoengine.fields.StringField object at 0x80a2bcf10>,
  66. 'to_oid': <mongoengine.fields.StringField object at 0x80a2c6050>,
  67. 'uuid': <mongoengine.fields.UUIDField object at 0x80a2c60d0>}
  68. errors_dict = {}
  69. value = UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')
  70. data =
  71. {'id': ObjectId('4eeb5058bcf4b106a3000099'),
  72. u'is_builtin': True,
  73. u'rewrite_oid': u'1.3.6.1.4.1.259.8.1.5',
  74. u'to_oid': u'1.3.6.1.4.1.259.6.10.94',
  75. u'uuid': UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')}
  76. field = <mongoengine.fields.StringField object at 0x80a2c6090>
  77. _auto_dereference = True
  78. son =
  79. {u'_id': ObjectId('4eeb5058bcf4b106a3000099'),
  80. u'is_builtin': True,
  81. u'rewrite_oid': u'1.3.6.1.4.1.259.8.1.5',
  82. u'to_oid': u'1.3.6.1.4.1.259.6.10.94',
  83. u'uuid': UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')}
  84. field_name = 'description'
  85. cls = <class 'noc.fm.models.oidalias.OIDAlias'>
  86. ------------------------------------------------------------------------
  87. File: lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 161)
  88. Function: __getitem__
  89. 154 queryset._document._from_son(queryset._cursor[key],
  90. 155 _auto_dereference=self._auto_dereference,
  91. 156 only_fields=self.only_fields))
  92. 157
  93. 158 if queryset._as_pymongo:
  94. 159 return queryset._get_as_pymongo(queryset._cursor[key])
  95. 160 return queryset._document._from_son(queryset._cursor[key],
  96. 161 ==> _auto_dereference=self._auto_dereference, only_fields=self.only_fields)
  97. 162
  98. 163 raise AttributeError
  99. 164
  100. 165 def __iter__(self):
  101. 166 raise NotImplementedError
  102. 167
  103. Variables:
  104. self = repr() failed
  105. queryset = repr() failed
  106. key = 0
  107. ------------------------------------------------------------------------
  108. File: lib/python2.7/site-packages/mongoengine/queryset/base.py (Line: 309)
  109. Function: first
  110. 302 return doc, True
  111. 303
  112. 304 def first(self):
  113. 305 """Retrieve the first object matching the query.
  114. 306 """
  115. 307 queryset = self.clone()
  116. 308 try:
  117. 309 ==> result = queryset[0]
  118. 310 except IndexError:
  119. 311 result = None
  120. 312 return result
  121. 313
  122. 314 def insert(self, doc_or_docs, load_bulk=True, write_concern=None):
  123. 315 """bulk insert documents
  124. Variables:
  125. self = repr() failed
  126. queryset = []
  127. ------------------------------------------------------------------------
  128. File: lib/collection.py (Line: 205)
  129. Function: get_by_uuid
  130. 198 del self.items[u]
  131. 199 self.changed = True
  132. 200
  133. 201 def get_by_uuid(self, u):
  134. 202 """
  135. 203 Returns object instance or None
  136. 204 """
  137. 205 ==> d = self.doc.objects.filter(uuid=u).first()
  138. 206 if d:
  139. 207 return d
  140. 208 else:
  141. 209 # Try to fix UUID
  142. 210 c = self.doc._get_collection()
  143. 211 d = c.find_one({"uuid": str(u)})
  144. Variables:
  145. self = <noc.lib.collection.Collection object at 0x80a595c10>
  146. u = UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')
  147. ------------------------------------------------------------------------
  148. File: lib/collection.py (Line: 357)
  149. Function: upgrade_item
  150. 350 """
  151. 351 def upgrade_item(u):
  152. 352 d = self.load_item(collection.items[u])
  153. 353 if d is None:
  154. 354 p = self.get_item_path(collection.items[u])
  155. 355 self.die("File not found: %s" % p)
  156. 356 d = self.dereference(self.doc, d)
  157. 357 ==> o = self.get_by_uuid(d["uuid"])
  158. 358 if o:
  159. 359 return # Already upgraded
  160. 360 for un in unique:
  161. 361 o = self.doc.objects.filter(**{un: d[un]}).first()
  162. 362 if o:
  163. 363 self.logger.info("Upgrading %s", unicode(o))
  164. Variables:
  165. self = <noc.lib.collection.Collection object at 0x80a595c10>
  166. unique = set(['rewrite_oid'])
  167. u = UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')
  168. d =
  169. {'rewrite_oid': '1.3.6.1.4.1.259.8.1.5',
  170. 'to_oid': '1.3.6.1.4.1.259.6.10.94',
  171. 'uuid': UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')}
  172. collection = <noc.lib.collection.Collection object at 0x80a5953d0>
  173. ------------------------------------------------------------------------
  174. File: lib/collection.py (Line: 382)
  175. Function: upgrade_collection
  176. 375 if not unique:
  177. 376 for spec in self.doc._meta["index_specs"]:
  178. 377 if spec.get("unique") and len(spec["fields"]) == 1:
  179. 378 unique.add(spec["fields"][0][0])
  180. 379 break
  181. 380 for u in collection.items:
  182. 381 try:
  183. 382 ==> upgrade_item(u)
  184. 383 except DereferenceError:
  185. 384 pass
  186. 385
  187. 386 def install_item(self, data, load=False):
  188. 387 o = self.doc(**self.dereference(self.doc, data))
  189. 388 self.logger.info("Installing %s", unicode(o))
  190. Variables:
  191. f = 'rewrite_oid'
  192. self = <noc.lib.collection.Collection object at 0x80a595c10>
  193. collection = <noc.lib.collection.Collection object at 0x80a5953d0>
  194. u = UUID('0652ed85-1c9b-4a65-9e2d-5d2ce062e263')
  195. upgrade_item = <function upgrade_item at 0x80a534cf8>
  196. unique = set(['rewrite_oid'])
  197. spec = {'fields': [('rewrite_oid', 1)], 'unique': True, 'sparse': False}
  198. _ = 1
  199. ------------------------------------------------------------------------
  200. File: lib/collection.py (Line: 171)
  201. Function: apply
  202. 164 ## Apply migration sequences
  203. 165 for f, u in LEGACY_COLLECTIONS[self.name]:
  204. 166 self.doc._get_collection().update(f, u)
  205. 167 ##
  206. 168 self.upgrade_collection(collection)
  207. 169 if not self.items:
  208. 170 # Empty local file, needs to upgrade collection first
  209. 171 ==> self.upgrade_collection(collection)
  210. 172 self.logger.debug("Syncing %s.%s" % (self.module, self.name))
  211. 173 sl = set(self.items)
  212. 174 sr = set(collection.items)
  213. 175 # Delete revoked items
  214. 176 for i in collection.get_revoked_items():
  215. 177 if i in self.items:
  216. Variables:
  217. self = <noc.lib.collection.Collection object at 0x80a595c10>
  218. collection = <noc.lib.collection.Collection object at 0x80a5953d0>
  219. ------------------------------------------------------------------------
  220. File: main/management/commands/collection.py (Line: 182)
  221. Function: handle_sync
  222. 175 DocCategory.fix_all()
  223. 176 try:
  224. 177 for name, doc in self.collections:
  225. 178 lc = Collection(name, doc, local=True)
  226. 179 lc.load()
  227. 180 dc = Collection(name, doc)
  228. 181 dc.load()
  229. 182 ==> lc.apply(dc)
  230. 183 except ValueError, why:
  231. 184 raise CommandError(why)
  232. 185 except DereferenceError, why:
  233. 186 raise CommandError(why)
  234. 187
  235. 188 def handle_upgrade(self, collections):
  236. Variables:
  237. doc = <class 'noc.fm.models.oidalias.OIDAlias'>
  238. self = <noc.main.management.commands.collection.Command object at 0x80a3954d0>
  239. dc = <noc.lib.collection.Collection object at 0x80a5953d0>
  240. name = 'fm.oidaliases'
  241. lc = <noc.lib.collection.Collection object at 0x80a595c10>
  242. ------------------------------------------------------------------------
  243. File: main/management/commands/collection.py (Line: 146)
  244. Function: _handle
  245. 139 except:
  246. 140 error_report()
  247. 141 sys.exit(1)
  248. 142
  249. 143 def _handle(self, *args, **options):
  250. 144 self.verbose = bool(options.get("verbosity"))
  251. 145 if options["cmd"] == "sync":
  252. 146 ==> return self.handle_sync()
  253. 147 elif options["cmd"] == "upgrade":
  254. 148 return self.handle_upgrade(args)
  255. 149 elif options["cmd"] == "install":
  256. 150 if len(args) < 2:
  257. 151 parts = args[0].split(os.path.sep)
  258. 152 if (len(parts) < 2 or parts[1] != "collections"):
  259. Variables:
  260. self = <noc.main.management.commands.collection.Command object at 0x80a3954d0>
  261. args = ()
  262. options =
  263. {'cmd': 'sync',
  264. 'pythonpath': None,
  265. 'settings': None,
  266. 'traceback': None,
  267. 'verbosity': '1'}
  268. ------------------------------------------------------------------------
  269. File: main/management/commands/collection.py (Line: 136)
  270. Function: handle
  271. 129 msg = "%s\nAvailable collections:" % msg
  272. 130 for n, d in self.collections:
  273. 131 msg = "%s\n %s" % (msg, n)
  274. 132 return msg
  275. 133
  276. 134 def handle(self, *args, **kwargs):
  277. 135 try:
  278. 136 ==> self._handle(*args, **kwargs)
  279. 137 except CommandError:
  280. 138 raise
  281. 139 except:
  282. 140 error_report()
  283. 141 sys.exit(1)
  284. 142
  285. Variables:
  286. self = <noc.main.management.commands.collection.Command object at 0x80a3954d0>
  287. args = ()
  288. kwargs =
  289. {'cmd': 'sync',
  290. 'pythonpath': None,
  291. 'settings': None,
  292. 'traceback': None,
  293. 'verbosity': '1'}
  294. ------------------------------------------------------------------------
  295. END OF TRACEBACK
  296. ERROR:noc.lib.debug:Writing CP report to local/cp/crashinfo/new/81a9bbad-f825-5ad3-bf1e-b9b0ae9f29b2.json
  297. upgrade-user: 45: collection --sync failed
  298. Terminating
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement