aabouzaid / netbox-as-ansible-inventory

Ansible dynamic inventory script for Netbox.
GNU General Public License v3.0
174 stars 54 forks source link

Bug : Boolean hostvars are not correctly retrieved #16

Closed Keyhaku closed 6 years ago

Keyhaku commented 6 years ago

Hello,

It seems that netbox.py doesn't fetch correctly boolean custom_field.

netbox version used : 2.3.1

Steps to reproduce

  1. Create a boolean custom_field
  2. Assign the value "False" on this custom_field on a device (in my case it was a virtual machine)
  3. Assign the value "True" on this custom_field on another device
  4. Modify netbox.yml to fetch this custom_field
  5. List host_vars, the device with "False" will not have this host_var listed

Code to change

Line 300 (in get_host_vars() function) if var_value should be if var_value is not None

aabouzaid commented 6 years ago

@Keyhaku thanks a lot for your report. Since this really easy to change and you already suggested the code change, feel free to make PR.