allegro / ralph

Ralph is the CMDB / Asset Management system for data center and back office hardware.
https://ralph.allegro.tech/
Apache License 2.0
2.24k stars 550 forks source link

issue importing rack information #3358

Open MylesL opened 5 years ago

MylesL commented 5 years ago

Steps to reproduce

hi, i've encountered issue while try to import document(csv,json,xls)

image Django Version: 1.8.19 Python Version: 3.4.3 Installed Applications: ('ralph.admin', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.humanize', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_rq', 'import_export', 'mptt', 'reversion', 'sitetree', 'ralph.accounts', 'ralph.assets', 'ralph.attachments', 'ralph.back_office', 'ralph.configuration_management', 'ralph.dashboards', 'ralph.data_center', 'ralph.dhcp', 'ralph.deployment', 'ralph.licences', 'ralph.domains', 'ralph.trade_marks', 'ralph.supports', 'ralph.security', 'ralph.lib.foundation', 'ralph.lib.table', 'ralph.networks', 'ralph.data_importer', 'ralph.dc_view', 'ralph.reports', 'ralph.virtual', 'ralph.operations', 'ralph.lib.external_services', 'ralph.lib.transitions', 'ralph.lib.permissions', 'ralph.lib.custom_fields', 'ralph.lib.hooks', 'ralph.notifications', 'ralph.ssl_certificates', 'rest_framework', 'rest_framework.authtoken', 'taggit', 'taggit_serializer') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'threadlocals.middleware.ThreadLocalMiddleware')

Traceback: File "/opt/ralph/ralph-core/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response

  1. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python3.4/contextlib.py" in inner
  2. return func(*args, **kwds) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/django/utils/decorators.py" in _wrapped_view
  3. response = view_func(request, *args, **kwargs) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  4. response = view_func(request, *args, **kwargs) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/django/contrib/admin/sites.py" in inner
  5. return view(request, *args, **kwargs) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/import_export/admin.py" in process_import
  6. user=request.user) File "/usr/lib/python3.4/contextlib.py" in inner
  7. return func(*args, **kwds) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/import_export/resources.py" in import_data
  8. six.reraise(*sys.exc_info()) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/django/utils/six.py" in reraise
  9. raise value File "/opt/ralph/ralph-core/lib/python3.4/site-packages/import_export/resources.py" in import_data
  10. self.save_m2m(instance, row, real_dry_run) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/import_export/resources.py" in save_m2m
  11. self.import_field(field, obj, data) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/import_export/resources.py" in import_field
  12. field.save(obj, data) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/import_export/fields.py" in save
  13. setattr(obj, attrs[-1], self.clean(data)) File "/opt/ralph/ralph-core/lib/python3.4/site-packages/django/db/models/fields/related.py" in set
  14. "intermediary model. Use %s.%s's Manager instead." % (opts.app_label, opts.object_name)

Exception Type: AttributeError at /data_center/rack/process_import/ Exception Value: Cannot set values on a ManyToManyField which specifies an intermediary model. Use data_center.RackAccessory's Manager instead.

could you please help take a look where the issue is and how to fix it ?

Expected behavior

file should be imported.

Actual behavior

file failed importing

Environment

root@ip-172-31-27-166:/opt/ralph/ralph-core/bin# dpkg -l "ralph" Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-=======================================-========================-========================-==================================================================================== ii ralph-core 3.0.0-snapshot-20181109- amd64 Ralph is an DCIM/CMDB - asset management for Data Centers/ Back Office.

xuebb commented 5 years ago

I got the same error.

adamwoolhether commented 4 years ago

Yea, I'm unable to import from yml, son, xlsx either...

mperniola commented 3 years ago

Same error today...

DonNeelin commented 2 years ago

I can import 64 records at a time in a JSON file. Anything more will result in the 500 error.