Skip to content

Set node attributes from device/all groups#2745

Merged
ipspace merged 1 commit intodevfrom
grp-builtin
Oct 15, 2025
Merged

Set node attributes from device/all groups#2745
ipspace merged 1 commit intodevfrom
grp-builtin

Conversation

@ipspace
Copy link
Owner

@ipspace ipspace commented Oct 14, 2025

The device/all groups are not allowed to have static members. It was thus impossible to set node attributes in a device/all group.

This change adds dynamic calculation of group members for device/all groups. Making that work reliably required several other changes:

  • The 'set node device/module' function has to apply group values in two passes. It has to apply group.device in the first pass and group.module in the second pass because changing node.device could change group membership for a device group.
  • Computing members of a BGP autogroup now takes into account whether the global BGP module will be propagated into a node during the module initialization.
  • The 'should we propagate modules' check was refactored into a separate function because it's used during module initialization as well as during BGP autogroup creation.
  • node.device could be unspecified when BGP autogroup function calls the 'propagate_global_modules' check, but we know the only possible value that could be applied later on is the default device (because group-based devices were already set).

The device/all groups are not allowed to have static members. It was
thus impossible to set node attributes in a device/all group.

This change adds dynamic calculation of group members for device/all
groups. Making that work reliably required several other changes:

* The 'set node device/module' function has to apply group values in
  two passes. It has to apply group.device in the first pass and
  group.module in the second pass because changing node.device could
  change group membership for a device group.
* Computing members of a BGP autogroup now takes into account whether
  the global BGP module will be propagated into a node during the
  module initialization.
* The 'should we propagate modules' check was refactored into a
  separate function because it's used during module initialization as
  well as during BGP autogroup creation.
* node.device could be unspecified when BGP autogroup function calls
  the 'propagate_global_modules' check, but we know the only possible
  value that could be applied later on is the default device (because
  group-based devices were already set).
@ipspace ipspace requested a review from jbemmel October 14, 2025 08:44
@ipspace ipspace linked an issue Oct 14, 2025 that may be closed by this pull request
Copy link
Collaborator

@jbemmel jbemmel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor considerations

@ipspace ipspace merged commit 0f6d153 into dev Oct 15, 2025
13 checks passed
@ipspace ipspace deleted the grp-builtin branch October 15, 2025 06:55
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.

The default 'all' group applies only for Ansible variables

2 participants