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

Device Rackposition not changeable #81

Closed
mkrsn opened this issue Mar 3, 2021 · 6 comments · Fixed by #90
Closed

Device Rackposition not changeable #81

mkrsn opened this issue Mar 3, 2021 · 6 comments · Fixed by #90
Assignees
Labels
type: bug Something isn't working as expected
Milestone

Comments

@mkrsn
Copy link

mkrsn commented Mar 3, 2021

Environment

  • Python version: Python 3.8.5
  • Nautobot version: v1.0.0b1

Steps to Reproduce

  1. Go to Devices and click on a existing Device
  2. Click Edit Button
  3. Scroll Down to "Location" and Open "Position"

Expected Behavior

When opening the List it should display the Units of the assigned Rack.

Observed Behavior

It just shows: "The results could not be loaded"

Screenshot_20210303_092251

It is only possible to assigne a Device to a Rack position while creating it. After the Device was created it's not possible to edit the position anymore. I've cross checked it with https://demo.nautobot.com/ - same Behavior.

@jathanism
Copy link
Contributor

Confirmed! Thanks for the bug report.

@jathanism jathanism added the type: bug Something isn't working as expected label Mar 3, 2021
@jathanism jathanism added this to the v1.0.0 milestone Mar 3, 2021
@jathanism jathanism added the status: help wanted Extra attention is needed label Mar 3, 2021
@glennmatthews
Copy link
Contributor

https://github.com/nautobot/nautobot/blob/develop/nautobot/dcim/api/serializers.py#L346

exclude is an IntegerField but needs to be changed to a UUIDField now that we have UUID PKs instead of integer PKs.

@jathanism
Copy link
Contributor

We should also add a regression test for this. Seems to me more detailed filter testing should have caught this.

@jathanism jathanism self-assigned this Mar 4, 2021
@jathanism jathanism removed the status: help wanted Extra attention is needed label Mar 4, 2021
@jathanism
Copy link
Contributor

Turns out it's not a filter but a query serializer that is being used as if it were a filter by drf-yasg.

jathanism added a commit to jathanism/nautobot that referenced this issue Mar 4, 2021
This particular case is unique because it's a "query serializer" used to parse the query params for the `RackViewSet.elevation` method which was previously untested in this waty.

- Swapped `nautobot.dcim.api.serializers.RackElevationDetailFilterSerializer.exclude` from `IntegerField` to `UUIDField`
- Added a new test `nautobot.dcim.tests.test_api.RackTest.test_filter_rack_elevation`
- Also revised validation of this serializer to raise an exception if invalid instead of returning a `Response` with
status code 400. Functionally equivalent, but operationally it's more correct to let the serializer raise an exception.
  - Made the same fixes in `nautobot.ipam.api.views` and `nautobot.extras.api.views`
jathanism added a commit that referenced this issue Mar 4, 2021
Fix #81 - Device Rack Position now changeable
@jathanism
Copy link
Contributor

Thanks @mkrsn ! :)

@mkrsn
Copy link
Author

mkrsn commented Mar 5, 2021

Thanks for fixing / Nautobot! :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants