Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Syncing noc.vendors:
- Syncing noc.modelinterfaces:
- Syncing noc.connectiontypes:
- Syncing noc.objectmodels:
- ERROR:root:UNHANDLED EXCEPTION (2013-10-29 23:46:15.943682)
- Working directory: /opt/noc
- <class 'mongoengine.base.ValidationError'>
- Unable to dereference <class 'noc.inv.models.vendor.Vendor'>:526f70977e85c911fa76cfe6
- START OF TRACEBACK
- ------------------------------------------------------------------------
- File: /opt/noc/lib/nosql.py (Line: 103)
- Function: __get__
- 96 # Dereference DBRefs
- 97 if isinstance(value, ObjectId):
- 98 v = self.document_type.objects(id=value).first()
- 99 if v is not None:
- 100 instance._data[self.name] = v
- 101 else:
- 102 raise ValidationError("Unable to dereference %s:%s" % (
- 103 ==> self.document_type, value))
- 104 return super(PlainReferenceField, self).__get__(instance, owner)
- 105
- 106 def to_mongo(self, document):
- 107 if isinstance(document, Document):
- 108 # We need the id from the saved object to create the DBRef
- 109 id_ = document.id
- Variables:
- owner = <class 'noc.inv.models.objectmodel.ObjectModel'>
- instance = <ObjectModel: Cisco | ME3400E | ME34X-PWR-AC>
- self = <noc.lib.nosql.PlainReferenceField object at 0x3f41290>
- value = ObjectId('526f70977e85c911fa76cfe6')
- v = None
- ------------------------------------------------------------------------
- File: /opt/noc/main/management/commands/sync-collections.py (Line: 120)
- Function: sync_item
- 113 # Dereference ref_field__field lookups
- 114 if "__" in i and not i.startswith("__"):
- 115 i, f = i.split("__")
- 116 if i not in self.doc._fields:
- 117 self.die("Invalid lookup field: %s" % i)
- 118 ref = self.doc._fields[i].document_type
- 119 v = self.lookup(ref, f, v)
- 120 ==> cv = getattr(obj, i)
- 121 if cv is None or cv.id != v.id:
- 122 changed = True
- 123 setattr(obj, i, v)
- 124 continue
- 125 # Process fields
- 126 try:
- Variables:
- sk = [{'name': 'Cisco | ME3400E | ME34X-PWR-AC'}]
- changed = False
- obj = <ObjectModel: Cisco | ME3400E | ME34X-PWR-AC>
- d =
- {'connections': [{'description': 'PSU connect to switch',
- 'direction': 'o',
- 'gender': 'm',
- 'group': '0',
- 'name': 'in',
- 'type': <ConnectionType: Cisco | ME3400E | PSU>,
- 'type__name': 'Cisco | ME3400E | PSU'}],
- 'data': {'asset': {'part_no0': 'ME34X-PWR-AC'}},
- 'description': 'AC PSU for Cisco ME3400E Series switches',
- 'is_builtin': True,
- 'name': 'Cisco | ME3400E | ME34X-PWR-AC',
- 'vendor__code': 'CISCO'}
- f = 'code'
- i = 'vendor'
- allow_partial = True
- dd =
- {'description': 'PSU connect to switch',
- 'direction': 'o',
- 'gender': 'm',
- 'group': '0',
- 'name': 'in',
- 'type': <ConnectionType: Cisco | ME3400E | PSU>,
- 'type__name': 'Cisco | ME3400E | PSU'}
- created = False
- edoc = <class 'noc.inv.models.objectmodel.ObjectModelConnection'>
- self =
- <noc.main.management.commands.sync-collections.CollectionSync object at 0x4f36cd0>
- ii = 'description'
- field = <mongoengine.fields.BooleanField object at 0x3f41210>
- u = 'name'
- vv = 'Cisco | ME3400E | PSU'
- v = <Vendor: Cisco Systems>
- y = 'PSU connect to switch'
- x = 'description'
- ref = <class 'noc.inv.models.vendor.Vendor'>
- k = {'name': 'Cisco | ME3400E | ME34X-PWR-AC'}
- partial = False
- ------------------------------------------------------------------------
- File: /opt/noc/main/management/commands/sync-collections.py (Line: 197)
- Function: sync
- 190 self.unique = set()
- 191 for index in self.doc._meta["unique_indexes"]:
- 192 for f, flag in index:
- 193 self.unique.add(f)
- 194 # Sync items
- 195 retry = []
- 196 for d in self.get_data():
- 197 ==> item_id, to_retry = self.sync_item(d, True)
- 198 try:
- 199 self.builtin_ids.remove(item_id)
- 200 except KeyError:
- 201 pass
- 202 if to_retry:
- 203 retry += [d]
- Variables:
- index = [('name', 1)]
- retry = []
- d =
- {'connections': [{'description': 'PSU connect to switch',
- 'direction': 'o',
- 'gender': 'm',
- 'group': '0',
- 'name': 'in',
- 'type': <ConnectionType: Cisco | ME3400E | PSU>,
- 'type__name': 'Cisco | ME3400E | PSU'}],
- 'data': {'asset': {'part_no0': 'ME34X-PWR-AC'}},
- 'description': 'AC PSU for Cisco ME3400E Series switches',
- 'is_builtin': True,
- 'name': 'Cisco | ME3400E | ME34X-PWR-AC',
- 'vendor__code': 'CISCO'}
- f = 'name'
- self =
- <noc.main.management.commands.sync-collections.CollectionSync object at 0x4f36cd0>
- o = <ObjectModel: Huawei | Quidway S5300 | Stack cable>
- item_id = '526f70987e85c911fa76d08a'
- flag = 1
- to_retry = False
- ------------------------------------------------------------------------
- File: /opt/noc/main/management/commands/sync-collections.py (Line: 267)
- Function: handle
- 260 if not a:
- 261 raise CommandError("Invalid collection: %s" % name)
- 262 CollectionSync(*a)
- 263 else:
- 264 # Sync all collections
- 265 for app, collections in self.collections:
- 266 for collection, doc in collections:
- 267 ==> CollectionSync(app, collection, doc).sync()
- 268 except CommandError, why:
- 269 raise CommandError(why)
- 270 except:
- 271 error_report()
- Variables:
- doc = <class 'noc.inv.models.objectmodel.ObjectModel'>
- app = 'inv'
- args = ()
- collection = 'objectmodels'
- self =
- <noc.main.management.commands.sync-collections.Command object at 0x4f36910>
- collections =
- [('vendors', <class 'noc.inv.models.vendor.Vendor'>),
- ('modelinterfaces', <class 'noc.inv.models.modelinterface.ModelInterface'>),
- ('connectiontypes', <class 'noc.inv.models.connectiontype.ConnectionType'>),
- ('objectmodels', <class 'noc.inv.models.objectmodel.ObjectModel'>)]
- options =
- {'pythonpath': None, 'settings': None, 'traceback': None, 'verbosity': '1'}
- ------------------------------------------------------------------------
- END OF TRACEBACK
- Syncronizing refbooks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement