Skip to content

Bump AttributesRewriter to use force_override precedence

Previously AttributesRewriter set its loaded attributes to the default precedence, but this meant that role attributes would always take precedence.

This worked only because recipes/prepare_attributes.rb assigned node to have the updated attributes. Subsequent recipes, such as those in cookbook-gitlab-runner, all used this updated node object.

In Chef 14, the DSL was more permissive, allowing such reassignments without immediate issues. However, in Chef 16, the node object is more strictly managed, and reassigning it no longer appears to work.

Instead of relying on this reassigned node object, change AttributesRewriter#rewrite! to use the force_override precedence, which is higher than the override precedence used by roles and environments.

Edited by Stan Hu

Merge request reports

Loading