ansible_modules icon indicating copy to clipboard operation
ansible_modules copied to clipboard

[Bug]: Cable length is a float no int

Open rodewalder opened this issue 3 years ago • 2 comments

Ansible NetBox Collection version

v3.7.1

Ansible version

2.12

NetBox version

v3.2.2

Python version

3.10

Steps to Reproduce

Add cables with a float, for example cable length 4.5.

Expected Behavior

Cable will be created with a length of 4.5

Observed Behavior

the cable creation fails, because expect int.

"msg": "argument 'length' is of type <class 'float'> found in 'data'. and we were unable to convert to int: <class 'float'> cannot be converted to an int"}

rodewalder avatar Jul 29 '22 09:07 rodewalder

Yep. It's saved as a DecimalField in the API server - https://github.com/netbox-community/netbox/blob/develop/netbox/dcim/models/cables.py#L81

Let's fix it.

sc68cal avatar Jul 29 '22 15:07 sc68cal

@rodewalder https://github.com/netbox-community/ansible_modules/blob/devel/plugins/modules/netbox_cable.py#L307 is the line that needs to change (and probably some unit tests) if you are interested in making a contribution

sc68cal avatar Jul 29 '22 15:07 sc68cal