Skip to content
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

[Bug]: Altering custom_field fails when ui_visibility: is used #1210

Open
jhofmueller opened this issue Apr 15, 2024 · 4 comments
Open

[Bug]: Altering custom_field fails when ui_visibility: is used #1210

jhofmueller opened this issue Apr 15, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@jhofmueller
Copy link

Ansible NetBox Collection version

v3.17.0

Ansible version

ansible [core 2.14.13]
  config file = None
  configured module search path = ['/home/jogi/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/jogi/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.11.8 (main, Feb  7 2024, 21:52:08) [GCC 13.2.0] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True

NetBox version

v3.7.5

Python version

3.11

Steps to Reproduce

Run this playbook twice:

  hosts: 127.0.0.1
  gather_facts: false
  become: false
  connection: local

  tasks:
    - name: Create one custom field
      netbox.netbox.netbox_custom_field:
        netbox_url: NETBOX_URI
        netbox_token: NETBOX_TOKEN
        data:
          content_types:
            - ipam.ipaddress
          default: two
          description: description
          filter_logic: loose
          group_name: group
          label: dummy
          name: dummy
          required: false
          search_weight: 1
          type: text
          ui_visibility: read-write
        state: present

The first run works as expected, creating the custom variable.

PLAY [Playbook :: Install/Upgrade Docker Containers for Netbox] *****************************************************************************************************************************

TASK [Create one custom field] **************************************************************************************************************************************************************
changed: [localhost]

PLAY RECAP **********************************************************************************************************************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

The second run however fails:

PLAY [Playbook :: Install/Upgrade Docker Containers for Netbox] *****************************************************************************************************************************

TASK [Create one custom field] **************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3.11"}, "changed": false, "msg": "ui_visibility does not exist on existing object. Check to make sure valid field."}

PLAY RECAP **********************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

Expected Behavior

I expected either an unchanged message or a change message in case something was changed.

Observed Behavior

ui_visibility does not exist on existing object

@jhofmueller jhofmueller added the bug Something isn't working label Apr 15, 2024
@sc68cal
Copy link
Contributor

sc68cal commented Apr 15, 2024

I believe we have merged code that fixes this, but we have not cut a new release yet.

@ccieblogger
Copy link

Hello, we are seeing the same behavior. Initial run works but seems to ignore ui_visibility value and just sets the default for the object. Subsequent runs fail and display the following error.

failed: [localhost] (item={'name': 'SiteID', 'description': 'Defines the site ID', 'content_types': ['dcim.site'], 'type': 'integer', 'ui_visibility': 'read-only', 'ui_editable': False, 'required': True}) => changed=false
ansible_loop_var: item
item:
content_types:
- dcim.site
description: Defines the site ID
name: SiteID
required: true
type: integer
ui_editable: false
ui_visibility: read-only
msg: ui_visibility does not exist on existing object. Check to make sure valid field.

@bluikko
Copy link
Contributor

bluikko commented Jun 27, 2024

This seems to be possibly a duplicate of #1135. Unfortunately I have had to put the associated PR on hold since pynetbox has not seen updates in half a year and we are re-evaluating the use of NetBox vs. a fork.

@Andres1357
Copy link

Hi, curious if this fix is back on the roadmap now that pynetbox has a new release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants