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

copying credential with really long name causes 500 #2752

Open
jlmitch5 opened this issue Nov 19, 2018 · 1 comment
Open

copying credential with really long name causes 500 #2752

jlmitch5 opened this issue Nov 19, 2018 · 1 comment

Comments

@jlmitch5
Copy link
Contributor

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • API
SUMMARY

If you try to copy a credential with a really long name you get a 500 error

ENVIRONMENT
  • AWX version: devel
STEPS TO REPRODUCE
  1. create aws credential with name "awsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsawsaw"
  2. click the copy button in the ui next to the credential.
EXPECTED RESULTS

Copied credential is created

ACTUAL RESULTS

500 error

Traceback:  

File "/venv/awx/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "./awx/wsgi.py" in _legacy_get_response
  71.         return super(AWXWSGIHandler, self)._legacy_get_response(request)

File "/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/venv/awx/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/venv/awx/lib/python2.7/site-packages/django/utils/decorators.py" in inner
  185.                     return func(*args, **kwargs)

File "/venv/awx/lib/python2.7/site-packages/django/views/decorators/csrf.py" in wrapped_view
  58.         return view_func(*args, **kwargs)

File "/venv/awx/lib/python2.7/site-packages/django/views/generic/base.py" in view
  68.             return self.dispatch(request, *args, **kwargs)

File "./awx/api/generics.py" in dispatch
  328.         return super(APIView, self).dispatch(request, *args, **kwargs)

File "/venv/awx/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  494.             response = self.handle_exception(exc)

File "/venv/awx/lib/python2.7/site-packages/rest_framework/views.py" in handle_exception
  454.             self.raise_uncaught_exception(exc)

File "/venv/awx/lib/python2.7/site-packages/rest_framework/views.py" in dispatch
  491.             response = handler(request, *args, **kwargs)

File "./awx/api/generics.py" in post
  974.             copy_name=serializer.validated_data.get('name', '')

File "./awx/api/generics.py" in copy_model_obj
  918.         new_obj = model.objects.create(**create_kwargs)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  85.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/query.py" in create
  394.         obj.save(force_insert=True, using=self.db)

File "./awx/main/models/credential/__init__.py" in save
  383.         super(Credential, self).save(*args, **kwargs)

File "./awx/main/models/base.py" in save
  198.         super(PasswordFieldsModel, self).save(*args, **kwargs)

File "./awx/main/models/base.py" in save
  316.         super(PrimordialModel, self).save(*args, **kwargs)

File "./awx/main/models/base.py" in save
  164.         super(CreatedModifiedModel, self).save(*args, **kwargs)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/base.py" in save
  808.                        force_update=force_update, update_fields=update_fields)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/base.py" in save_base
  838.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/base.py" in _save_table
  924.             result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/base.py" in _do_insert
  963.                                using=using, raw=raw)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/manager.py" in manager_method
  85.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/query.py" in _insert
  1079.         return query.get_compiler(using=using).execute_sql(return_id)

File "/venv/awx/lib/python2.7/site-packages/django/db/models/sql/compiler.py" in execute_sql
  1112.                 cursor.execute(sql, params)

File "/venv/awx/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)

File "/venv/awx/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

File "/venv/awx/lib/python2.7/site-packages/django/db/utils.py" in __exit__
  94.                 six.reraise(dj_exc_type, dj_exc_value, traceback)

File "/venv/awx/lib/python2.7/site-packages/django/db/backends/utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

Exception Type: DataError at /api/v2/credentials/5/copy/
Exception Value: value too long for type character varying(512)
@shanemcd
Copy link
Member

shanemcd commented Apr 4, 2023

Still happening in 2023!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants