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

1.4.8在default里进行批量更新资产报错 #2579

Closed
RaynorAZ opened this Issue Apr 3, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@RaynorAZ
Copy link

commented Apr 3, 2019

[简述你的问题]
资产列表中,右键default组进行批量更新资产出现报错

使用版本

1.4.8

问题复现步骤
  1. 右键根路径选择更新资产
    2.弹出框中出现报错
具体表现[截图可能会更好些,最好能截全]

image
Task assets.tasks.test_asset_connectivity_util[657df949-695b-45bb-afe5-3adaf5d2d9bf] raised unexpected: IntegrityError(1062, "Duplicate entry 'Test if the assets under the node are connectable: Default' for key 'name'")
Traceback (most recent call last):
File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py", line 502, in update_or_create
obj = self.select_for_update().get(**lookup)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py", line 399, in get
self.model._meta.object_name
ops.models.adhoc.Task.DoesNotExist: Task matching query does not exist.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 255, in execute
self.errorhandler(self, exc, value)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 252, in execute
res = self._query(query)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 378, in _query
db.query(q)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/connections.py", line 280, in query
_mysql.connection.query(self, query)
_mysql_exceptions.IntegrityError: (1062, "Duplicate entry 'Test if the assets under the node are connectable: Default' for key 'name'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/py3/lib/python3.6/site-packages/celery/app/trace.py", line 374, in trace_task
R = retval = fun(*args, **kwargs)
File "/opt/py3/lib/python3.6/site-packages/celery/app/trace.py", line 629, in protected_call
return self.run(*args, **kwargs)
File "/data0/jumpserver/jumpserver/apps/assets/tasks.py", line 167, in test_asset_connectivity_util
options=const.TASK_OPTIONS, run_as_admin=True, created_by=created_by,
File "/data0/jumpserver/jumpserver/apps/ops/utils.py", line 34, in update_or_create_ansible_task
defaults=defaults, name=task_name, created_by=created_by
File "/opt/py3/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py", line 506, in update_or_create
obj, created = self._create_object_from_params(lookup, params, lock=True)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py", line 530, in _create_object_from_params
raise e
File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py", line 522, in _create_object_from_params
obj = self.create(**params)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py", line 413, in create
obj.save(force_insert=True, using=self.db)
File "/data0/jumpserver/jumpserver/apps/ops/models/adhoc.py", line 99, in save
using=using, update_fields=update_fields,
File "/opt/py3/lib/python3.6/site-packages/django/db/models/base.py", line 718, in save
force_update=force_update, update_fields=update_fields)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/base.py", line 748, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/base.py", line 831, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/base.py", line 869, in _do_insert
using=using, raw=raw)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/query.py", line 1136, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/opt/py3/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1289, in execute_sql
cursor.execute(sql, params)
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/opt/py3/lib/python3.6/site-packages/django/db/utils.py", line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
File "/opt/py3/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 255, in execute
self.errorhandler(self, exc, value)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
raise errorvalue
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 252, in execute
res = self._query(query)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/cursors.py", line 378, in _query
db.query(q)
File "/opt/py3/lib/python3.6/site-packages/MySQLdb/connections.py", line 280, in query
_mysql.connection.query(self, query)
django.db.utils.IntegrityError: (1062, "Duplicate entry 'Test if the assets under the node are connectable: Default' for key 'name'")

其他

[注:] 完成后请关闭 issue

@wojiushixiaobai

This comment has been minimized.

Copy link
Collaborator

commented Apr 24, 2019

@RaynorAZ 请更新到最新版本后再看看问题是否复现,如果任然有问题请重新打开此问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.