Project

Profile

Help

Issue #6657

closed

Better error messages if collection field doesn't fit DB field length

Added by osapryki over 4 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 73
Quarter:

Description

Collection import task should produce human readable error message instead of the traceback below, in case when collection metadata doesn't match database model requirements, such as URL field is bigger than max_length for that field.

Actual behavior:

value too long for type character varying(128)
  File "/venv/lib64/python3.6/site-packages/rq/worker.py", line 884, in perform_job
    rv = job.perform()
  File "/venv/lib64/python3.6/site-packages/rq/job.py", line 664, in perform
    self._result = self._execute()
  File "/venv/lib64/python3.6/site-packages/rq/job.py", line 670, in _execute
    return self.func(*self.args, **self.kwargs)
  File "/venv/lib64/python3.6/site-packages/pulp_ansible/app/tasks/collections.py", line 162, in import_collection
    collection_version.save()
  File "/venv/lib64/python3.6/site-packages/pulp_ansible/app/models.py", line 185, in save
    super().save(*args, **kwargs)
  File "/venv/lib64/python3.6/site-packages/pulpcore/app/models/base.py", line 107, in save
    return super().save(*args, **kwargs)
  File "/venv/lib64/python3.6/site-packages/django/db/models/base.py", line 741, in save
    force_update=force_update, update_fields=update_fields)
  File "/venv/lib64/python3.6/site-packages/django/db/models/base.py", line 779, in save_base
    force_update, using, update_fields,
  File "/venv/lib64/python3.6/site-packages/django/db/models/base.py", line 870, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/venv/lib64/python3.6/site-packages/django/db/models/base.py", line 908, in _do_insert
    using=using, raw=raw)
  File "/venv/lib64/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/venv/lib64/python3.6/site-packages/django/db/models/query.py", line 1186, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/venv/lib64/python3.6/site-packages/django/db/models/sql/compiler.py", line 1375, in execute_sql
    cursor.execute(sql, params)
  File "/venv/lib64/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/venv/lib64/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/venv/lib64/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/venv/lib64/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/venv/lib64/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)

Also available in: Atom PDF