Skip to content

Commit

Permalink
fix: Update default LXD meta-data with user meta-data (#5584)
Browse files Browse the repository at this point in the history
This was previously unnecessary because:

a. LXD automatically appends the user.meta-data key to default meta-data.
b. In the presence of duplicate keys, PyYAML uses the last key.

This change is the cloud-init part of a set of changes that will enable cloud-init
to avoid depending on undefined behavior. In the future LXD may stop
appending user-defined meta-data to its default meta-data. This change
makes cloud-init forward compatible to LXD for when that change is
implemented.

GH-5575
  • Loading branch information
holmanb authored Aug 5, 2024
1 parent 0aea65c commit c0ffdd4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cloudinit/sources/DataSourceLXD.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ def _get_data(self) -> bool:
config = self._crawled_metadata.get("config", {})
user_metadata = config.get("user.meta-data", {})
if user_metadata:
user_metadata = _raw_instance_data_to_dict(
"user.meta-data", user_metadata
self.metadata.update(
_raw_instance_data_to_dict("user.meta-data", user_metadata)
)
if "user-data" in self._crawled_metadata:
self.userdata_raw = self._crawled_metadata["user-data"]
Expand Down

0 comments on commit c0ffdd4

Please sign in to comment.