Skip to content

Can't create new sitegroup with parent using REST api #6258

@PeterO2

Description

@PeterO2

NetBox version

v2.11.0

Python version

3.6

Steps to Reproduce

Post a new sitegroup to api/dcim/site-groups/ with data {"name":"name","slug":"slug","parent":< id >} where parent is id of an existing sitegroup.

Expected Behavior

A new sitegroup should have been created with parent showing the sitegroup where parent refers to.

Observed Behavior

A 500 Internal Error is returned.
{
"error": "Cannot assign "<Region: Region1>": "SiteGroup.parent" must be a "SiteGroup" instance.",
"exception": "ValueError",
"netbox_version": "2.11.0",
"python_version": "3.6.9"
}

Bug is already detected in the code here: https://github.com/netbox-community/netbox/blob/master/netbox/dcim/api/serializers.py#L93
But it's not sure if it's the only cause.

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions