Skip to content

DeviceInitCheckApi should verify device hostname #417

@Qwiko

Description

@Qwiko

Describe the bug
DeviceInitCheckApi does not verify device hostname and causes psycopg2.errors.UniqueViolation if a device is initialized with an already used hostname.

To Reproduce
Steps to reproduce the behavior:

  1. Init a device with a hostname that is already used by another device.

Expected behavior
Initcheck should verify hostname and return an error if it is a duplicate or not validated.

Outputs

Exception message: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "device_hostname_key"
DETAIL: Key (hostname)=(xxx-xx-xx01-a1) already exists.
[SQL: UPDATE device SET hostname=%(hostname)s WHERE device.id = %(device_id)s]
[parameters:
 {'hostname': 'xxx-xx-xx01-a1',
 'device_id': 20}
] (Background on this error at: https://sqlalche.me/e/20/gkpj)

Environment:

  • Setup Sunet CNaaS
  • Version 1.7.0b1
  • Client webui

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions