feat(helpers): support custom datasource vendor merge strategies#6944
Open
goldberl wants to merge 1 commit into
Open
feat(helpers): support custom datasource vendor merge strategies#6944goldberl wants to merge 1 commit into
goldberl wants to merge 1 commit into
Conversation
2 tasks
When deploying a MAAS node with custom user-data, top-level lists in vendor-data (e.g., `write_files`) are dropped if user-data defines the same keys. This breaks networking by dropping the MAAS Netplan configuration (`/etc/netplan/50-maas.yaml`). To fix this without affecting other cloud providers, this change allows datasources to specify custom merge strategies: - `ConfigMerger` checks the active datasource (`self._ds`) for a `vendor_merge_how` attribute when loading vendor cloud config. - `DataSourceMAAS` sets `vendor_merge_how` to append list values. Signed-off-by: Leah Goldberg <leah.goldberg@canonical.com> Fixes canonicalGH-6268 LP: #2158442
goldberl
force-pushed
the
fix/maas-vendor-data-merge
branch
from
July 20, 2026 19:01
a312d1f to
9cb7f50
Compare
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 top-level lists in vendor-data (such as
write_files) are silently dropped when user-data defines the same keys, which breaks MAAS deployments by wiping out the Netplan network configuration (/etc/netplan/50-maas.yaml).To resolve this without altering global merge behavior across other cloud providers,
ConfigMergernow inspects the active datasource for avendor_merge_howattribute.DataSourceMAASsets this attribute tolist(append)+dict(no_replace,recurse_list)+str(), ensuring MAAS-generated vendor lists are appended to user lists.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 for DataSourceMAAS 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