Netbox: Invalid value for custom field when bulk edit VM

Created on 23 Dec 2020  路  2Comments  路  Source: netbox-community/netbox

Environment

  • Python version: 3.8.6
  • NetBox version: v2.10.2

Steps to Reproduce

  1. add cusom field vm_id to Virtual Machine (Text, required)
  2. add some VM with different vm_id
  3. select VMs on VM list and click "Edit selected"
  4. change "Tenant" and click "Apply"

Expected Behavior

Tenant should be changed as when I edit single VM.

Observed Behavior

Get validation error:
name_of_first_vm_on_the_list failed validation: {'__all__': ["Invalid value for custom field 'vm_id': Required field cannot be empty."]}

accepted bug

All 2 comments

I found out it is probably caused by improper bulk edit mechanic. In 2.10.1 as well as 2.10.2 even if editing one field in objects you need to provide values for all of them. Otherwise it defaults to overwriting them to become empty.

As per your example you probably have vm_id marked as required, you didn't provide a value for it because you just want to change "Tenant" so it is empty. Of course requiried field cannot be empty so you get validation error.

This incorrect behavior affects not only VM's but other models as well such as Racks. It connects with bulk edit custom fields and after I fill required custom fields again it overwrites other custom fields with empty data.

Was this page helpful?
0 / 5 - 0 ratings