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

Nautobot 1.3 Limits Job Name length #1679

Closed
nniehoff opened this issue Apr 22, 2022 · 0 comments · Fixed by #1681
Closed

Nautobot 1.3 Limits Job Name length #1679

nniehoff opened this issue Apr 22, 2022 · 0 comments · Fixed by #1681
Assignees
Labels
type: bug Something isn't working as expected

Comments

@nniehoff
Copy link
Contributor

Environment

  • Python version: 3.7
  • Nautobot version: 1.3.1

In Nautobot 1.2.11 we had a job name which is longer than 100 characters, this was allowed. After upgrading to Nautobot 1.3 I am now running into the following stack trace and Nautobot is unable to start:

nautobot_1  | Traceback (most recent call last):
nautobot_1  |   File "/usr/local/bin/nautobot-server", line 8, in <module>
nautobot_1  |     sys.exit(main())
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot/core/cli.py", line 54, in main
nautobot_1  |     run_app(
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot/core/runner/runner.py", line 266, in run_app
nautobot_1  |     management.execute_from_command_line([runner_name, command] + command_args)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
nautobot_1  |     utility.execute()
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 413, in execute
nautobot_1  |     self.fetch_command(subcommand).run_from_argv(self.argv)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
nautobot_1  |     self.execute(*args, **cmd_options)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
nautobot_1  |     output = self.handle(*args, **options)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot/core/management/commands/post_upgrade.py", line 78, in handle
nautobot_1  |     call_command(
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 181, in call_command
nautobot_1  |     return command.execute(*args, **defaults)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
nautobot_1  |     output = self.handle(*args, **options)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 89, in wrapped
nautobot_1  |     res = handle_func(*args, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 268, in handle
nautobot_1  |     emit_post_migrate_signal(
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/core/management/sql.py", line 42, in emit_post_migrate_signal
nautobot_1  |     models.signals.post_migrate.send(
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 180, in send
nautobot_1  |     return [
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
nautobot_1  |     (receiver, receiver(signal=self, sender=sender, **named))
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot/core/apps/__init__.py", line 616, in post_migrate_send_nautobot_database_ready
nautobot_1  |     nautobot_database_ready.send(sender=app_conf, app_config=app_conf, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 180, in send
nautobot_1  |     return [
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/dispatch/dispatcher.py", line 181, in <listcomp>
nautobot_1  |     (receiver, receiver(signal=self, sender=sender, **named))
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot/extras/signals.py", line 233, in refresh_job_models
nautobot_1  |     job_model, _ = refresh_job_model_from_job_class(Job, source, job_class, git_repository=git_repository)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/nautobot/extras/utils.py", line 220, in refresh_job_model_from_job_class
nautobot_1  |     job_model, created = job_model_class.objects.get_or_create(
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
nautobot_1  |     return getattr(self.get_queryset(), name)(*args, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 588, in get_or_create
nautobot_1  |     return self.create(**params), True
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 453, in create
nautobot_1  |     obj.save(force_insert=True, using=self.db)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 739, in save
nautobot_1  |     self.save_base(using=using, force_insert=force_insert,
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 776, in save_base
nautobot_1  |     updated = self._save_table(
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 881, in _save_table
nautobot_1  |     results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 919, in _do_insert
nautobot_1  |     return manager._insert(
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
nautobot_1  |     return getattr(self.get_queryset(), name)(*args, **kwargs)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1270, in _insert
nautobot_1  |     return query.get_compiler(using=using).execute_sql(returning_fields)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1416, in execute_sql
nautobot_1  |     cursor.execute(sql, params)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 98, in execute
nautobot_1  |     return super().execute(sql, params)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/cacheops/transaction.py", line 97, in execute
nautobot_1  |     result = self._no_monkey.execute(self, sql, params)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
nautobot_1  |     return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
nautobot_1  |     return executor(sql, params, many, context)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
nautobot_1  |     return self.cursor.execute(sql, params)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
nautobot_1  |     raise dj_exc_value.with_traceback(traceback) from exc_value
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
nautobot_1  |     return self.cursor.execute(sql, params)
nautobot_1  |   File "/usr/local/lib/python3.9/site-packages/django_prometheus/db/common.py", line 71, in execute
nautobot_1  |     return super().execute(*args, **kwargs)
nautobot_1  | django.db.utils.DataError: value too long for type character varying(100)

Steps to Reproduce

  1. In Nautobot 1.2.11 create a job name longer than 100 characters
  2. Upgrade to Nautobot 1.3

Expected Behavior

Nautobot should start

Observed Behavior

Nautobot Fails to start (see stack trace)

@glennmatthews glennmatthews added the type: bug Something isn't working as expected label Apr 22, 2022
@glennmatthews glennmatthews self-assigned this Apr 22, 2022
glennmatthews added a commit that referenced this issue Apr 26, 2022
* Enforce JobModel database field length limits. Fixes #1679

* Use hard-coded values in data migration
glennmatthews added a commit that referenced this issue Apr 26, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants