netbox: Device_count is not updated on device roles if a device is removed/add to the role

Environment

  • Python version: v3.6.8
  • NetBox version: v2.6.5

Steps to Reproduce

  1. Create a new device role
  2. Add an existing device to it
  3. Check the api response on device_count
  4. Remove the device from it
  5. Check the api response on device_count

Expected Behavior

I expect the device_count to be correctly updated

Observed Behavior

When adding an existing device to the role, the role’s device_count stays at null. When a new device is created and added to the role directly, the device_count is still null.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

FYI I am looking into what it will take to solve this upstream in cacheops by supporting subqueries natively.