{"action":"created","issue":{"url":"https://api.github.com/repos/digitalocean/netbox/issues/1977","repository_url":"https://api.github.com/repos/digitalocean/netbox","labels_url":"https://api.github.com/repos/digitalocean/netbox/issues/1977/labels{/name}","comments_url":"https://api.github.com/repos/digitalocean/netbox/issues/1977/comments","events_url":"https://api.github.com/repos/digitalocean/netbox/issues/1977/events","html_url":"https://github.com/digitalocean/netbox/issues/1977","id":307105123,"node_id":"MDU6SXNzdWUzMDcxMDUxMjM=","number":1977,"title":"Error when creating Virtual Chassis","user":{"login":"andyshinn","id":315485,"node_id":"MDQ6VXNlcjMxNTQ4NQ==","avatar_url":"https://avatars1.githubusercontent.com/u/315485?v=4","gravatar_id":"","url":"https://api.github.com/users/andyshinn","html_url":"https://github.com/andyshinn","followers_url":"https://api.github.com/users/andyshinn/followers","following_url":"https://api.github.com/users/andyshinn/following{/other_user}","gists_url":"https://api.github.com/users/andyshinn/gists{/gist_id}","starred_url":"https://api.github.com/users/andyshinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andyshinn/subscriptions","organizations_url":"https://api.github.com/users/andyshinn/orgs","repos_url":"https://api.github.com/users/andyshinn/repos","events_url":"https://api.github.com/users/andyshinn/events{/privacy}","received_events_url":"https://api.github.com/users/andyshinn/received_events","type":"User","site_admin":false},"labels":[{"id":401612483,"node_id":"MDU6TGFiZWw0MDE2MTI0ODM=","url":"https://api.github.com/repos/digitalocean/netbox/labels/status:%20accepted","name":"status: accepted","color":"0e8a16","default":false},{"id":333772677,"node_id":"MDU6TGFiZWwzMzM3NzI2Nzc=","url":"https://api.github.com/repos/digitalocean/netbox/labels/type:%20bug","name":"type: bug","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2018-03-21T02:54:57Z","updated_at":"2018-07-18T14:51:12Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n    Before opening a new issue, please search through the existing issues to\r\n    see if your topic has already been addressed. Note that you may need to\r\n    remove the \"is:open\" filter from the search bar to include closed issues.\r\n\r\n    Check the appropriate type for your issue below by placing an x between the\r\n    brackets. For assistance with installation issues, or for any other issues\r\n    other than those listed below, please raise your topic for discussion on\r\n    our mailing list:\r\n\r\n        https://groups.google.com/forum/#!forum/netbox-discuss\r\n\r\n    Please note that issues which do not fall under any of the below categories\r\n    will be closed. Due to an excessive backlog of feature requests, we are\r\n    not currently accepting any proposals which extend NetBox's feature scope.\r\n\r\n    Do not prepend any sort of tag to your issue's title. An administrator will\r\n    review your issue and assign labels as appropriate.\r\n--->\r\n### Issue type\r\n[ ] Feature request <!-- An enhancement of existing functionality -->\r\n[x] Bug report      <!-- Unexpected or erroneous behavior -->\r\n[ ] Documentation   <!-- A modification to the documentation -->\r\n\r\n<!--\r\n    Please describe the environment in which you are running NetBox. (Be sure\r\n    to verify that you are running the latest stable release of NetBox before\r\n    submitting a bug report.) If you are submitting a bug report and have made\r\n    any changes to the code base, please first validate that your bug can be\r\n    recreated while running an official release.\r\n-->\r\n### Environment\r\n* Python version:  3.6.4\r\n* NetBox version:  v2.3.1\r\n\r\nRunning as a Docker container (built myself from v2.3.1 tag). `DEBUG` is set `True`.\r\n\r\n<!--\r\n    BUG REPORTS must include:\r\n        * A list of the steps needed for someone else to reproduce the bug\r\n        * A description of the expected and observed behavior\r\n        * Any relevant error messages (screenshots may also help)\r\n\r\n    FEATURE REQUESTS must include:\r\n        * A detailed description of the proposed functionality\r\n        * A use case for the new feature\r\n        * A rough description of any necessary changes to the database schema\r\n        * Any relevant third-party libraries which would be needed\r\n-->\r\n### Description\r\n\r\nI am getting an error trying to create a virtual chassis for two devices. I am able to make virtual chassis for other devices so it seems to be specific to these two. I initially added these two devices to a Virtual Chassis cluster by mistake before I realized the correct way to create a Virtual Chassis.\r\n\r\nSteps:\r\n\r\n1. Navigate to Devices view.\r\n1. Check the box next to both devices.\r\n1. On bottom of page click Create Virtual Chassis.\r\n1. Set Master and Position for each and click Create.\r\n\r\nThe below error is then shown:\r\n\r\n```\r\nThere was a problem with your request. Please contact an administrator.\r\n\r\nThe complete exception is provided below:\r\n\r\n<class 'django.db.utils.IntegrityError'>\r\n\r\nduplicate key value violates unique constraint \"dcim_device_virtual_chassis_id_vc_position_efea7133_uniq\"\r\nDETAIL:  Key (virtual_chassis_id, vc_position)=(5, 1) already exists.\r\n\r\nRequest Method: | POST\r\n-- | --\r\nhttp://lb.netbox.staging.keenai.com:8000/dcim/virtual-chassis/add/\r\n1.11.11\r\nIntegrityError\r\nduplicate key value violates unique constraint \"dcim_device_virtual_chassis_id_vc_position_efea7133_uniq\" DETAIL:  Key (virtual_chassis_id, vc_position)=(8, 1) already exists.\r\n/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py in execute, line 64\r\n/usr/local/bin/python\r\n3.6.4\r\n['/usr/src/app/netbox',  '/usr/local/lib/python36.zip',  '/usr/local/lib/python3.6',  '/usr/local/lib/python3.6/lib-dynload',  '/usr/local/lib/python3.6/site-packages']\r\n```\r\n\r\nTraceback:\r\n\r\n```\r\nEnvironment:\r\n\r\n\r\nRequest Method: POST\r\nRequest URL: http://lb.netbox.staging.mydomain.com:8000/dcim/virtual-chassis/add/\r\n\r\nDjango Version: 1.11.11\r\nPython Version: 3.6.4\r\nInstalled Applications:\r\n('django.contrib.admin',\r\n 'django.contrib.auth',\r\n 'django.contrib.contenttypes',\r\n 'django.contrib.sessions',\r\n 'django.contrib.messages',\r\n 'django.contrib.staticfiles',\r\n 'django.contrib.humanize',\r\n 'corsheaders',\r\n 'debug_toolbar',\r\n 'django_filters',\r\n 'django_tables2',\r\n 'mptt',\r\n 'rest_framework',\r\n 'rest_framework_swagger',\r\n 'timezone_field',\r\n 'circuits',\r\n 'dcim',\r\n 'ipam',\r\n 'extras',\r\n 'secrets',\r\n 'tenancy',\r\n 'users',\r\n 'utilities',\r\n 'virtualization')\r\nInstalled Middleware:\r\n('debug_toolbar.middleware.DebugToolbarMiddleware',\r\n 'corsheaders.middleware.CorsMiddleware',\r\n 'django.contrib.sessions.middleware.SessionMiddleware',\r\n 'django.middleware.common.CommonMiddleware',\r\n 'django.middleware.csrf.CsrfViewMiddleware',\r\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\r\n 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',\r\n 'django.contrib.messages.middleware.MessageMiddleware',\r\n 'django.middleware.clickjacking.XFrameOptionsMiddleware',\r\n 'django.middleware.security.SecurityMiddleware',\r\n 'utilities.middleware.ExceptionHandlingMiddleware',\r\n 'utilities.middleware.LoginRequiredMiddleware',\r\n 'utilities.middleware.APIVersionMiddleware')\r\n\r\n\r\n\r\nTraceback:\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py\" in execute\r\n  64.                 return self.cursor.execute(sql, params)\r\n\r\nThe above exception (duplicate key value violates unique constraint \"dcim_device_virtual_chassis_id_vc_position_efea7133_uniq\"\r\nDETAIL:  Key (virtual_chassis_id, vc_position)=(8, 1) already exists.\r\n) was the direct cause of the following exception:\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py\" in inner\r\n  41.             response = get_response(request)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py\" in _get_response\r\n  187.                 response = self.process_exception_by_middleware(e, request)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py\" in _get_response\r\n  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/views/generic/base.py\" in view\r\n  68.             return self.dispatch(request, *args, **kwargs)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/contrib/auth/mixins.py\" in dispatch\r\n  92.         return super(PermissionRequiredMixin, self).dispatch(request, *args, **kwargs)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/views/generic/base.py\" in dispatch\r\n  88.         return handler(request, *args, **kwargs)\r\n\r\nFile \"/usr/src/app/netbox/dcim/views.py\" in post\r\n  2114.                         device.save()\r\n\r\nFile \"/usr/src/app/netbox/dcim/models.py\" in save\r\n  1046.         super(Device, self).save(*args, **kwargs)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/base.py\" in save\r\n  808.                        force_update=force_update, update_fields=update_fields)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/base.py\" in save_base\r\n  838.             updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/base.py\" in _save_table\r\n  905.                                       forced_update)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/base.py\" in _do_update\r\n  955.         return filtered._update(values) > 0\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/query.py\" in _update\r\n  664.         return query.get_compiler(self.db).execute_sql(CURSOR)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py\" in execute_sql\r\n  1204.         cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py\" in execute_sql\r\n  899.             raise original_exception\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py\" in execute_sql\r\n  889.             cursor.execute(sql, params)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py\" in execute\r\n  79.             return super(CursorDebugWrapper, self).execute(sql, params)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py\" in execute\r\n  64.                 return self.cursor.execute(sql, params)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/utils.py\" in __exit__\r\n  94.                 six.reraise(dj_exc_type, dj_exc_value, traceback)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/utils/six.py\" in reraise\r\n  685.             raise value.with_traceback(tb)\r\n\r\nFile \"/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py\" in execute\r\n  64.                 return self.cursor.execute(sql, params)\r\n\r\nException Type: IntegrityError at /dcim/virtual-chassis/add/\r\nException Value: duplicate key value violates unique constraint \"dcim_device_virtual_chassis_id_vc_position_efea7133_uniq\"\r\nDETAIL:  Key (virtual_chassis_id, vc_position)=(8, 1) already exists.\r\n```\r\n\r\nI don't see anywhere I can remove the devices from another cluster or virtual chassis. Possible bug or did I do something wrong?"},"comment":{"url":"https://api.github.com/repos/digitalocean/netbox/issues/comments/405959008","html_url":"https://github.com/digitalocean/netbox/issues/1977#issuecomment-405959008","issue_url":"https://api.github.com/repos/digitalocean/netbox/issues/1977","id":405959008,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTk1OTAwOA==","user":{"login":"computer045","id":4334341,"node_id":"MDQ6VXNlcjQzMzQzNDE=","avatar_url":"https://avatars2.githubusercontent.com/u/4334341?v=4","gravatar_id":"","url":"https://api.github.com/users/computer045","html_url":"https://github.com/computer045","followers_url":"https://api.github.com/users/computer045/followers","following_url":"https://api.github.com/users/computer045/following{/other_user}","gists_url":"https://api.github.com/users/computer045/gists{/gist_id}","starred_url":"https://api.github.com/users/computer045/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/computer045/subscriptions","organizations_url":"https://api.github.com/users/computer045/orgs","repos_url":"https://api.github.com/users/computer045/repos","events_url":"https://api.github.com/users/computer045/events{/privacy}","received_events_url":"https://api.github.com/users/computer045/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T14:51:12Z","updated_at":"2018-07-18T14:51:12Z","author_association":"NONE","body":"I hope it's the same bug as the original reporter. Since he wasn't able to reproduce it, I am not sure. That is the only scenario where I had the error."}}
{"actor":{"display_login":"computer045"}}