Guest User

Untitled

a guest
Dec 25th, 2014
204
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Synchronize collections
  2. ERROR:noc.lib.debug:UNHANDLED EXCEPTION (2014-12-25 17:06:39.668519)
  3. Working directory: /opt/noc
  4. <class 'mongoengine.errors.NotUniqueError'>
  5. Tried to save duplicate unique keys (E11000 duplicate key error index: noc.noc.vendors.$name_1 dup key: { : "D-Link" })
  6. START OF TRACEBACK
  7. ------------------------------------------------------------------------
  8. File: /opt/noc/lib/python2.7/site-packages/mongoengine/document.py (Line: 286)
  9. Function: save
  10. 279 }
  11. 280 if cascade_kwargs: # Allow granular control over cascades
  12. 281 kwargs.update(cascade_kwargs)
  13. 282 kwargs['_refs'] = _refs
  14. 283 self.cascade_save(**kwargs)
  15. 284 except pymongo.errors.DuplicateKeyError, err:
  16. 285 message = u'Tried to save duplicate unique keys (%s)'
  17. 286 ==> raise NotUniqueError(message % unicode(err))
  18. 287 except pymongo.errors.OperationFailure, err:
  19. 288 message = 'Could not save document (%s)'
  20. 289 if re.match('^E1100[01] duplicate key', unicode(err)):
  21. 290 # E11000 - duplicate key error index
  22. 291 # E11001 - duplicate key on update
  23. 292 message = u'Tried to save duplicate unique keys (%s)'
  24. Variables:
  25. clean = True
  26. err =
  27. DuplicateKeyError(u'E11000 duplicate key error index: noc.noc.vendors.$name_1 dup key: { : "D-Link" }',)
  28. force_insert = False
  29. doc =
  30. SON([('name', u'D-Link'), ('code', u'DLINK'), ('site', u'http://www.dlink.com/'), ('uuid', UUID('deaacf21-325b-4b62-94d1-b8f3123e8f21')), ('_id', ObjectId('549c19ef4a5e68711c08f699'))])
  31. self = <Vendor: D-Link>
  32. created = True
  33. _refs = None
  34. collection =
  35. Collection(Database(MongoClient('localhost', 27017), u'noc'), u'noc.vendors')
  36. cascade = None
  37. write_concern = {'w': 1}
  38. cascade_kwargs = None
  39. kwargs = {}
  40. message = u'Tried to save duplicate unique keys (%s)'
  41. validate = True
  42. ------------------------------------------------------------------------
  43. File: /opt/noc/lib/collection.py (Line: 218)
  44. Function: update_item
  45. 211 if o:
  46. 212 # Update fields
  47. 213 for k in d:
  48. 214 setattr(o, k, d[k])
  49. 215 else:
  50. 216 # Create item
  51. 217 o = self.doc(**d)
  52. 218 ==> o.save()
  53. 219 self.items[mi.uuid] = mi
  54. 220 self.changed = True
  55. 221
  56. 222 def lookup(self, ref, field, key):
  57. 223 field = str(field)
  58. 224 if ref not in self.ref_cache:
  59. Variables:
  60. mi =
  61. CollectionItem(name='D-Link', uuid=UUID('deaacf21-325b-4b62-94d1-b8f3123e8f21'), path='DLINK.json', hash='1e0d7b170975361042d595ba7c75f3799bbf5399fe2159e49e187935b7c27903')
  62. self = <noc.lib.collection.Collection object at 0x505eed0>
  63. data =
  64. {'code': 'DLINK',
  65. 'name': 'D-Link',
  66. 'site': 'http://www.dlink.com/',
  67. 'uuid': 'deaacf21-325b-4b62-94d1-b8f3123e8f21'}
  68. d =
  69. {'code': 'DLINK',
  70. 'name': 'D-Link',
  71. 'site': 'http://www.dlink.com/',
  72. 'uuid': UUID('deaacf21-325b-4b62-94d1-b8f3123e8f21')}
  73. o = <Vendor: D-Link>
  74. ------------------------------------------------------------------------
  75. File: /opt/noc/lib/collection.py (Line: 162)
  76. Function: apply
  77. 155 sr = set(collection.items)
  78. 156 # Delete revoked items
  79. 157 for i in collection.get_revoked_items():
  80. 158 if i in self.items:
  81. 159 self.delete_item(i)
  82. 160 # Check for new items
  83. 161 for i in sr - sl:
  84. 162 ==> self.update_item(collection.items[i])
  85. 163 # Update changed items
  86. 164 for i in sr & sl:
  87. 165 if self.items[i].hash != collection.items[i].hash:
  88. 166 self.update_item(collection.items[i])
  89. 167 # Update partial items
  90. 168 for i in self.partial:
  91. Variables:
  92. i = UUID('deaacf21-325b-4b62-94d1-b8f3123e8f21')
  93. sr =
  94. set([UUID('0018a846-e3ad-4fa7-9352-6ac2e64b3048'),
  95. UUID('2f9cc9f6-19a1-4abf-86ac-7906065475d3'),
  96. UUID('393be551-8335-476d-b73d-f83aae285b37'),
  97. UUID('3b613993-3c19-4b04-9bd5-fcf01b7efecd'),
  98. UUID('43ca9798-c7ef-4f2f-ac9d-b1b547bb058f'),
  99. UUID('4d248e16-d835-4bac-8e01-a696d37c1761'),
  100. UUID('5000319a-cc5f-46f1-b2f4-23277db14ad6'),
  101. UUID('65634396-7826-4bfb-8092-5ed300e25445'),
  102. UUID('66e079d1-2fdd-4172-b850-c9359e55bbae'),
  103. UUID('6c888d44-b1dc-46d3-92a3-3e55f652b881'),
  104. UUID('6d0ea90b-6184-42c3-87a8-9f4271bf2383'),
  105. UUID('6e506a22-6f51-4b04-8e2f-3f240643d668'),
  106. UUID('770da8a7-df6c-4b28-9d66-a8c803cee5b2'),
  107. UUID('78305fbb-2cb2-4f67-8e94-659616856424'),
  108. UUID('89b344f1-14ae-4e2b-9c98-4eea13509f15'),
  109. UUID('8c5a642f-67b3-475a-ba39-b4835f7ead55'),
  110. UUID('9ae510be-7f03-4ff5-89f2-3504187762fe'),
  111. UUID('ae42a900-7e76-4cfe-93c3-21e3c7c9b1ba'),
  112. UUID('b06d7df2-e4d8-4697-aa24-6317530417f0'),
  113. UUID('b552bd2d-68b8-427b-a0f6-3775399cc7da'),
  114. UUID('b6af93da-bea4-40c2-8149-90172471b721'),
  115. UUID('b704b0b3-ba91-4a87-9d17-a8b92182e5be'),
  116. UUID('b8e63d51-ee3c-4e93-a782-27ae730be17f'),
  117. UUID('b98546f4-270d-4c3c-892f-25a5babc0af3'),
  118. UUID('befdf816-0aee-47c1-b84f-f93f0a7f6b79'),
  119. UUID('deaacf21-325b-4b62-94d1-b8f3123e8f21'),
  120. UUID('e5e779a2-3c25-4ba4-8644-10dd43ea7c0a'),
  121. UUID('eaffacec-f2ea-469f-90fa-6fafba9f9bbf'),
  122. UUID('ebae01bb-4677-4aee-a844-0161c5585a37'),
  123. UUID('eccf0b1f-349e-449c-8ead-0209b0df36a0'),
  124. UUID('ee35ecb4-0217-4f89-9196-6afd127322c3'),
  125. UUID('fa69f993-53ef-452e-a866-4df0e3dff3a5')])
  126. self = <noc.lib.collection.Collection object at 0x505eed0>
  127. collection = <noc.lib.collection.Collection object at 0x505eb10>
  128. sl = set([])
  129. ------------------------------------------------------------------------
  130. File: /opt/noc/main/management/commands/collection.py (Line: 177)
  131. Function: handle_sync
  132. 170 DocCategory.fix_all()
  133. 171 try:
  134. 172 for name, doc in self.collections:
  135. 173 lc = Collection(name, doc, local=True)
  136. 174 lc.load()
  137. 175 dc = Collection(name, doc)
  138. 176 dc.load()
  139. 177 ==> lc.apply(dc)
  140. 178 except ValueError, why:
  141. 179 raise CommandError(why)
  142. 180 except DereferenceError, why:
  143. 181 raise CommandError(why)
  144. 182
  145. 183 def handle_upgrade(self, collections):
  146. Variables:
  147. doc = <class 'noc.inv.models.vendor.Vendor'>
  148. self = <noc.main.management.commands.collection.Command object at 0x4e593d0>
  149. dc = <noc.lib.collection.Collection object at 0x505eb10>
  150. name = 'inv.vendors'
  151. lc = <noc.lib.collection.Collection object at 0x505eed0>
  152. ------------------------------------------------------------------------
  153. File: /opt/noc/main/management/commands/collection.py (Line: 141)
  154. Function: _handle
  155. 134 raise
  156. 135 except:
  157. 136 error_report()
  158. 137
  159. 138 def _handle(self, *args, **options):
  160. 139 self.verbose = bool(options.get("verbosity"))
  161. 140 if options["cmd"] == "sync":
  162. 141 ==> return self.handle_sync()
  163. 142 elif options["cmd"] == "upgrade":
  164. 143 return self.handle_upgrade(args)
  165. 144 elif options["cmd"] == "install":
  166. 145 if len(args) < 2:
  167. 146 parts = args[0].split(os.path.sep)
  168. 147 if (len(parts) < 2 or parts[1] != "collections"):
  169. Variables:
  170. self = <noc.main.management.commands.collection.Command object at 0x4e593d0>
  171. args = ()
  172. options =
  173. {'cmd': 'sync',
  174. 'pythonpath': None,
  175. 'settings': None,
  176. 'traceback': None,
  177. 'verbosity': '1'}
  178. ------------------------------------------------------------------------
  179. File: /opt/noc/main/management/commands/collection.py (Line: 132)
  180. Function: handle
  181. 125 msg = "%s\nAvailable collections:" % msg
  182. 126 for n, d in self.collections:
  183. 127 msg = "%s\n %s" % (msg, n)
  184. 128 return msg
  185. 129
  186. 130 def handle(self, *args, **kwargs):
  187. 131 try:
  188. 132 ==> self._handle(*args, **kwargs)
  189. 133 except CommandError:
  190. 134 raise
  191. 135 except:
  192. 136 error_report()
  193. 137
  194. 138 def _handle(self, *args, **options):
  195. Variables:
  196. self = <noc.main.management.commands.collection.Command object at 0x4e593d0>
  197. args = ()
  198. kwargs =
  199. {'cmd': 'sync',
  200. 'pythonpath': None,
  201. 'settings': None,
  202. 'traceback': None,
  203. 'verbosity': '1'}
  204. ------------------------------------------------------------------------
  205. END OF TRACEBACK
  206. Synchronizing pyRules
  207. Traceback (most recent call last):
  208. File "manage.py", line 35, in <module>
  209. import noc.urls
  210. File "/opt/noc/urls.py", line 18, in <module>
  211. site.autodiscover()
  212. File "/opt/noc/lib/app/site.py", line 473, in autodiscover
  213. {}, {}, "*")
  214. File "/opt/noc/inv/apps/inv/views.py", line 21, in <module>
  215. class InvApplication(ExtApplication):
  216. File "/opt/noc/lib/app/application.py", line 109, in __new__
  217. site.register(m)
  218. File "/opt/noc/lib/app/site.py", line 381, in register
  219. app = app_class(self)
  220. File "/opt/noc/inv/apps/inv/views.py", line 52, in __init__
  221. self.plugins[o.name] = o(self)
  222. File "/opt/noc/inv/apps/inv/plugins/base.py", line 22, in __init__
  223. self.init_plugin()
  224. File "/opt/noc/inv/apps/inv/plugins/conduits.py", line 61, in init_plugin
  225. self.conduits_model = ObjectModel.objects.get(name=self.CONDUITS_MODEL)
  226. File "/opt/noc/lib/python2.7/site-packages/mongoengine/queryset/base.py", line 186, in get
  227. raise queryset._document.DoesNotExist(msg)
  228. noc.inv.models.objectmodel.DoesNotExist: ObjectModel matching query does not exist.
  229. -e upgrade-user: : sync-pyrules failed
  230. Terminating
  231. upgrade complete
RAW Paste Data