[PDB Tech] Possible validation issue with Python wrapper

Martin J. Levy mahtin at mahtin.com
Sat Feb 25 00:12:12 PST 2017


Chris,

1) Just keep running in N times in a row.
2) Dump the database and sync a fresh one

One or both of those works.

Martin

> On Feb 25, 2017, at 4:05 PM, Chris Phillips <cphillips at aptient.com> wrote:
> 
> Is there documentation on how to properly upgrade?
> 
> I've upgraded the following and it just made things worse:
> 
> Django (1.9.12)
> django-peeringdb (0.3.1)
> peeringdb (0.5.0)
> pip (9.0.1)
> setuptools (34.3.0)
> 
> The error I am now getting is the following:
> 
> $ peeringdb sync
> Traceback (most recent call last):
>  File "/usr/local/bin/peeringdb", line 11, in <module>
>    load_entry_point('peeringdb==0.5.0', 'console_scripts', 'peeringdb')()
>  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
>    return self.main(*args, **kwargs)
>  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main
>    rv = self.invoke(ctx)
>  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
>    return _process_result(sub_ctx.command.invoke(sub_ctx))
>  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
>    return ctx.invoke(self.callback, **ctx.params)
>  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
>    return callback(*args, **kwargs)
>  File "/usr/local/lib/python2.7/site-packages/peeringdb/cli.py", line 163, in sync
>    from peeringdb.localdb import LocalDB
>  File "/usr/local/lib/python2.7/site-packages/peeringdb/localdb.py", line 7, in <module>
>    from django.db.models import get_app, get_models
> ImportError: cannot import name get_app
> 
>> On 2/24/2017 11:41 PM, Matt Griswold wrote:
>> You need to update django-peeringdb to get the new schema. We need
>> drastic improvement on the client to take care of issues like that.
>> 
>> On Feb 25, 2017 01:20, "Chris Phillips" <cphillips at aptient.com
>> <mailto:cphillips at aptient.com>> wrote:
>> 
>>    It appears that the Python wrapper is hanging on some invalid data
>>    in the database:
>> 
>>    $ peeringdb sync
>>    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): www.peeringdb.com
>>    <http://www.peeringdb.com>
>>    "GET /api/org?since=1487981821 HTTP/1.1" 200 None
>>    org last update 1487981821 5 changed
>>    data to be processed 5
>>    Starting new HTTPS connection (1): www.peeringdb.com
>>    <http://www.peeringdb.com>
>>    "GET /api/fac?since=1487981822 HTTP/1.1" 200 None
>>    fac last update 1487981822 0 changed
>>    data to be processed 0
>>    Starting new HTTPS connection (1): www.peeringdb.com
>>    <http://www.peeringdb.com>
>>    "GET /api/net?since=1485044224 HTTP/1.1" 200 None
>>    net last update 1485044224 839 changed
>>    data to be processed 839
>>    Traceback (most recent call last):
>>      File "/usr/local/bin/peeringdb", line 9, in <module>
>>        load_entry_point('peeringdb==0.4.4', 'console_scripts',
>>    'peeringdb')()
>>      File "/usr/local/lib/python2.7/site-packages/click/core.py", line
>>    716, in __call__
>>        return self.main(*args, **kwargs)
>>      File "/usr/local/lib/python2.7/site-packages/click/core.py", line
>>    696, in main
>>        rv = self.invoke(ctx)
>>      File "/usr/local/lib/python2.7/site-packages/click/core.py", line
>>    1060, in invoke
>>        return _process_result(sub_ctx.command.invoke(sub_ctx))
>>      File "/usr/local/lib/python2.7/site-packages/click/core.py", line
>>    889, in invoke
>>        return ctx.invoke(self.callback, **ctx.params)
>>      File "/usr/local/lib/python2.7/site-packages/click/core.py", line
>>    534, in invoke
>>        return callback(*args, **kwargs)
>>      File "/usr/local/lib/python2.7/site-packages/peeringdb/cli.py",
>>    line 167, in sync
>>        db.sync()
>>      File
>>    "/usr/local/lib/python2.7/site-packages/peeringdb/localdb.py", line
>>    140, in sync
>>        call_command('pdb_sync', interactive=False)
>>      File
>>    "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py",
>>    line 120, in call_command
>>        return command.execute(*args, **defaults)
>>      File
>>    "/usr/local/lib/python2.7/site-packages/django/core/management/base.py",
>>    line 445, in execute
>>        output = self.handle(*args, **options)
>>      File
>>    "/usr/local/lib/python2.7/site-packages/django_peeringdb/management/commands/pdb_sync.py",
>>    line 85, in handle
>>        self.sync(tables)
>>      File
>>    "/usr/local/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
>>    "/usr/local/lib/python2.7/site-packages/django_peeringdb/management/commands/pdb_sync.py",
>>    line 127, in update_db
>>        sync.sync_obj(cls, row)
>>      File
>>    "/usr/local/lib/python2.7/site-packages/django_peeringdb/sync.py",
>>    line 25, in sync_obj
>>        obj.full_clean()
>>      File
>>    "/usr/local/lib/python2.7/site-packages/django/db/models/base.py",
>>    line 1171, in full_clean
>>        raise ValidationError(errors)
>>    django.core.exceptions.ValidationError: {'info_type': [u"Value
>>    u'Route Server' is not a valid choice."]}
>> 
>>    Is there a workaround for this?
>> 
>>    --
>>    Chris Phillips
>>    Aptient Consulting Group Inc.
>>    +1 (917) 521-5290 <tel:%2B1%20%28917%29%20521-5290> - office
>>    +1 (250) 863-3519 <tel:%2B1%20%28250%29%20863-3519> - mobile
>>    _______________________________________________
>>    Pdb-tech mailing list
>>    Pdb-tech at lists.peeringdb.com <mailto:Pdb-tech at lists.peeringdb.com>
>>    http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
>>    <http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech>
>> 
> _______________________________________________
> Pdb-tech mailing list
> Pdb-tech at lists.peeringdb.com
> http://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech


More information about the Pdb-tech mailing list