Skip to content

Conversation

@dchiquito
Copy link
Contributor

@dchiquito dchiquito commented Oct 31, 2025

Related Issue

Fixes #1182

New Behavior

Netbox 4.3.0 changed the Contact.contact_group column to Contact.contact_groups, which subtly broke the netbox_contact module.

  • In the netbox_contact module, add the contact_groups field alongside the existing contact_group.
    *
  • Add integration tests for adding contacts to contact groups.
  • Add integration tests for contact groups in general.

Contrast to Current Behavior

To add a contact to a contact group, you must now use one of two fields: contact_group or contact_groups, depending on your Netbox version. An informative error will be thrown if you use the wrong one.

Discussion: Benefits and Drawbacks

Anyone who used the workarounds described in #1182 will probably need to update their playbooks.
The new API is much nicer IMHO.

Changes to the Documentation

No changes besides the updated auto module docs. The contact_group/contact_groups fields document which Netbox versions are valid.

Proposed Release Note Entry

Change netbox_contacts.contact_group to contact_groups (see #1182)

Double Check

  • I have read the comments and followed the CONTRIBUTING.md.
  • I have explained my PR according to the information in the comments or in a linked issue.
  • My PR targets the devel branch.

There were several places in `netbox_utils.py` that referred to
`contact_groups` for no apparent reason, and some that referred to
`contact_group` despite the feature being buggy (see
netbox-community#1182).

As a contact can belong to multiple groups, I think `contact_groups`
makes more sense, and fixes the bugggy behavior.
@dchiquito dchiquito marked this pull request as ready for review October 31, 2025 18:54
@dchiquito dchiquito marked this pull request as draft October 31, 2025 19:30
@dchiquito
Copy link
Contributor Author

I just discovered that https://github.com/netbox-community/netbox/releases/tag/v4.3.0 changed group to groups, so this new code will not work on older versions of Netbox.
I'm working on adding back a group field that will work with the old API while keeping groups that will work on the new API.

@dchiquito dchiquito marked this pull request as ready for review November 11, 2025 17:00
@dchiquito
Copy link
Contributor Author

Not sure why CI linting failed on netbox_virtual_machine.py, but it's an easy fix so I added it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot add contact_group to contact

1 participant