peeringdb / peeringdb-py

PeeringDB python client
BSD 2-Clause "Simplified" License
89 stars 22 forks source link

peeringdb-py 0.4.3 beta.peeringdb.com usage and ValidationError: {'name': [u'Internet exchange with this Name already exists.']} #6

Closed ccaputo closed 7 years ago

ccaputo commented 8 years ago

1) peeringdb-py presently queries beta.peeringdb.com, gets a redirect and then queries www.peeringdb.com. It might be time to just have it query www.peeringdb.com directly.

2) Got an error running 'peeringdb sync'. Below.

Did a 'pip install --upgrade peeringdb' and it still happened. (version 0.4.3 before and after upgrade check)

Erased the sqlite3 database and started from scratch. Error didn't happen first run or subsequent runs.

Also, I saved a copy of the sqlite3 file that triggers the stack error, if useful.

Operations to perform: Synchronize unmigrated apps: django_peeringdb Apply all migrations: admin, contenttypes, auth, sessions Synchronizing apps without migrations: Creating tables... Running deferred SQL... Installing custom SQL... Running migrations: No migrations to apply. Starting new HTTPS connection (1): beta.peeringdb.com "GET /api/org?since=1460509420 HTTP/1.1" 302 160 Starting new HTTPS connection (1): www.peeringdb.com "GET /api/org?since=1460509420 HTTP/1.1" 200 None org last update 1460509420 0 changed data to be processed 0 Starting new HTTPS connection (1): beta.peeringdb.com "GET /api/fac?since=1460505758 HTTP/1.1" 302 160 Starting new HTTPS connection (1): www.peeringdb.com "GET /api/fac?since=1460505758 HTTP/1.1" 200 None fac last update 1460505758 0 changed data to be processed 0 Starting new HTTPS connection (1): beta.peeringdb.com "GET /api/net?since=1460512875 HTTP/1.1" 302 160 Starting new HTTPS connection (1): www.peeringdb.com "GET /api/net?since=1460512875 HTTP/1.1" 200 None net last update 1460512875 0 changed data to be processed 0 Starting new HTTPS connection (1): beta.peeringdb.com "GET /api/ix?since=1460412076 HTTP/1.1" 302 160 Starting new HTTPS connection (1): www.peeringdb.com "GET /api/ix?since=1460412076 HTTP/1.1" 200 None ix last update 1460412076 3 changed data to be processed 3 Traceback (most recent call last): File "/home/seaix/src/wiki_ip_converter/pdbvenv/bin/peeringdb", line 11, in sys.exit(cli()) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/click/core.py", line 716, in call return self.main(args, _kwargs) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/click/core.py", line 1060, in invoke return process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/click/core.py", line 889, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/click/core.py", line 534, in invoke return callback(args, _kwargs) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/peeringdb/cli.py", line 125, in sync db.sync() File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/peeringdb/localdb.py", line 97, in sync call_command('pdb_sync', interactive=False) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/django/core/management/_init.py", line 120, in call_command return command.execute(args, defaults) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/django/core/management/base.py", line 445, in execute output = self.handle(args, options) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/django_peeringdb/management/commands/pdb_sync.py", line 85, in handle self.sync(tables) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/django_peeringdb/management/commands/pdb_sync.py", line 92, in sync self.update_db(cls, self.get_objs(cls)) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/django_peeringdb/management/commands/pdb_sync.py", line 127, in update_db sync.sync_obj(cls, row) File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/django_peeringdb/sync.py", line 25, in sync_obj obj.full_clean() File "/home/seaix/src/wiki_ip_converter/pdbvenv/lib/python2.7/site-packages/django/db/models/base.py", line 1171, in full_clean raise ValidationError(errors) django.core.exceptions.ValidationError: {'name': [u'Internet exchange with this Name already exists.']}

ccaputo commented 8 years ago

Confirm #1 (beta.peeringdb.com) was already fixed in 0.4.3.2. Still seeing issue with 0.4.3.2 unless I create a new local database from scratch.

ccaputo commented 8 years ago

Martin Levy has seen: django.core.exceptions.ValidationError: {'name': [u'Organization with this Name already exists.']}

grizz commented 8 years ago

This should be fixed with the 2.0.8 release, let us know if you see it happen again.

ccaputo commented 8 years ago

It happens again with the original sqlite file I had created with 0.4.3, even when running 0.4.3.2. Just now (with PDB 2.0.8) got these errors on different runs:

django.core.exceptions.ValidationError: {'name': [u'Facility with this Name already exists.']} django.core.exceptions.ValidationError: {'name': [u'Internet exchange with this Name already exists.']} django.core.exceptions.ValidationError: {'name': [u'Internet exchange with this Name already exists.']} django.core.exceptions.ValidationError: {'name': [u'Internet exchange with this Name already exists.']}

With the fresh sqlite file created from scratch a few days ago, things are fine.

grizz commented 8 years ago

Oh, what a novel idea, testing with that one. Could you email / scp me the SQL file? :)

ccaputo commented 8 years ago

wget from https://www.caputo.com/pdb_test/peeringdb_20160412_causes_error.sqlite3 and let me know when grabbed so I can remove.

grizz commented 8 years ago

Got it, thanks

grizz commented 7 years ago

This has been fixed, not sure why the issue is still open