fix(helpers): append vendor cloud-config lists instead of dropping them#6933
Open
goldberl wants to merge 1 commit into
Open
fix(helpers): append vendor cloud-config lists instead of dropping them#6933goldberl wants to merge 1 commit into
goldberl wants to merge 1 commit into
Conversation
When deploying a machine (such as a MAAS node) with a custom user-data configuration, top-level lists in vendor-data (e.g., `write_files` or `runcmd`) are silently ignored if the user-data contains the same keys. This occurs because user-data is loaded first, and the default merging strategy (`no_replace` with `recurse_list=False`) discards duplicate keys from subsequent sources. In MAAS deployments, this behavior breaks networking by completely dropping the MAAS-generated `write_files` block that writes the netplan configuration (e.g., `/etc/netplan/50-maas.yaml`), leaving only the PXE interface configured. This PR fixes this by updating `ConfigMerger._get_instance_configs` to inject a default `merge_how` strategy for `vendor_cloud_config` and `vendor2_cloud_config`. This updates the strategy to: `list(append)+dict(no_replace,recurse_list)+str()` This ensures vendor-defined lists are appended to user-defined lists rather than being discarded, while maintaining `no_replace` for dictionary values and strings. Signed-off-by: Leah Goldberg <leah.goldberg@canonical.com>
goldberl
force-pushed
the
adjust-cloud-config-merge-strategy
branch
from
July 14, 2026 16:26
c0aaba2 to
d8eb547
Compare
goldberl
marked this pull request as ready for review
July 14, 2026 18:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Commit Message
Additional Context
This PR fixes an issue where the default merge strategy for user-data and vendor-data silently discards critical vendor-data list keys (such as
write_files). Because user-data is loaded first, cloud-init's defaultno_replacestrategy drops matching vendor keys. This breaks networking on ephemeral platforms like MAAS by wiping out vendor generated netplan configurations.This fix injects a default
merge_howdirective into vendor configs (vendor_cloud_config, vendor2_cloud_config) to ensure list values are appended instead of dropped:list(append)+dict(no_replace,recurse_list)+str()For example:
user-data
vendor-data
The current way of merging is:
Notice how the
write_filesfrom the vendor-data is ignored since the user-data already definedwrite_files.This PR would change the merge to be:
This ensures list values are appended instead of dropped.
Test Steps
How to reproduce the bug
Actual behavior
The deployed machine only has the PXE interface (
enp5s0) configured.Expected behavior
10.20.0.1 (enp5s0.100)
The expected behavior is for both the PXE interface (
enp5s0) and the MAAS-configured VLAN interface (enp5s0.100) to remain configured after deployment.How to test this fix
Note: I tested this on MAAS 3.5.12 (snap) which uses Ubuntu 22.04 (Jammy).
You should see networking is set up properly now:
Related Links
Merge type