Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration failing on column extras_topologymap.type #1892

Closed
lae opened this issue Feb 17, 2018 · 4 comments
Closed

Migration failing on column extras_topologymap.type #1892

lae opened this issue Feb 17, 2018 · 4 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@lae
Copy link
Contributor

lae commented Feb 17, 2018

Issue type

[ ] Feature request
[x] Bug report
[ ] Documentation

Environment

  • Python version: 2.7, 3.4, 3.5, 3.6
  • NetBox version: develop @ 2d93c2b

Description

Performing the usual steps for deploying Netbox, the deploy appears to fail when running migrations

stdout: Operations to perform:
  Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, tenancy, users, virtualization
Running migrations:
  Applying extras.0004_topologymap_change_comma_to_semicolon...
:stderr: /srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 204, in handle
    fake_initial=fake_initial,
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 115, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 145, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 244, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/migration.py", line 129, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/migrations/operations/special.py", line 193, in database_forwards
    self.code(from_state.apps, schema_editor)
  File "/srv/netbox/releases/git-deploy/netbox/extras/migrations/0004_topologymap_change_comma_to_semicolon.py", line 11, in commas_to_semicolons
    for tm in TopologyMap.objects.filter(device_patterns__contains=','):
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 250, in __iter__
    self._fetch_all()
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/srv/netbox/current/venv-py2/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 899, in execute_sql
    raise original_exception
django.db.utils.ProgrammingError: column extras_topologymap.type does not exist
LINE 1: ...topologymap"."name", "extras_topologymap"."slug", "extras_to...
                                                             ^

(above error and context can be seen here: https://travis-ci.org/lae/ansible-role-netbox/jobs/342560899#L6417)

@terrytrent
Copy link

I'm having this issue as well, hopefully we can see this fixed quickly

@lampwins
Copy link
Contributor

lampwins commented Feb 17, 2018

Performing the usual steps for deploying Netbox

Keep in mind you are using the develop branch which makes no guarantees at being stable at given point in time. The master branch is the only branch considered stable for production deployment.

@lae
Copy link
Contributor Author

lae commented Feb 17, 2018

@lampwins I'm sorry if I wasn't clear, this is from my automated tests for NetBox before stable releases. I'm not using the develop branch in production.

See: https://travis-ci.org/lae/ansible-role-netbox/builds/342560897

Basically, I got notified that deployment tests were failing and so I'm reporting it upstream.

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Feb 21, 2018
@jeremystretch
Copy link
Member

Kudos to @lampwins for tracking this down to #632 back in v1.7.0. The issue appears to be this function in a prior migration which imports the TopologyMap model to automatically convert commas in regular expressions to semicolons.

Given that this is merely a convenience function which would only benefit someone upgrading from a release older than v1.7.0 (released 2016-11-03), the simplest solution is probably to just alter that migration and remove the function.

@jeremystretch jeremystretch added type: bug A confirmed report of unexpected behavior in the application status: accepted This issue has been accepted for implementation and removed status: revisions needed This issue requires additional information to be actionable labels Feb 21, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

4 participants