Skip to content

Inconsistent role requirement on virtual machine between API and WebUI #4168

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

Closed
netsandbox opened this issue Feb 14, 2020 · 1 comment
Closed
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@netsandbox
Copy link
Contributor

netsandbox commented Feb 14, 2020

Environment

  • Python version: 3.6.9
  • NetBox version: 2.7.6

Steps to Reproduce

  1. create virtual machine by API: role is not required
  2. create virtual machine in WebUI: role is required

Expected Behavior

If a role for a virtual machine is required or not should be the same for API and WebUI.

Observed Behavior

If you create a virtual machine by API, role isn't required.
If you create a virtual machine in the WebUI, role is required.

The VirtualMachine model defines blank=Trueand null=True, which makes role not required by API:
https://github.com/netbox-community/netbox/blob/v2.7.6/netbox/virtualization/models.py#L212-L219

The VirtualMachineForm doesn't have a required=False for role, which makes role required in the WebUI:
https://github.com/netbox-community/netbox/blob/v2.7.6/netbox/virtualization/forms.py#L352-L360

@hSaria
Copy link
Contributor

hSaria commented Feb 14, 2020

You're correct. This happened during some internal housekeeping (#3912). The solution would be to add required=False as you described.

@jeremystretch jeremystretch changed the title inconsistent role requirement on virtual machine between API and WebUI Inconsistent role requirement on virtual machine between API and WebUI Feb 14, 2020
@jeremystretch jeremystretch self-assigned this Feb 14, 2020
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Feb 14, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants