Skip to content

Commit

Permalink
ec2: handle base64 encoded metadata
Browse files Browse the repository at this point in the history
Experience has shown that there are a number of tools and common
patterns that effectively doubly base64 encode userdata.  This change
replaces a patch previously carried by Amazon Linux that was
incorrectly ported to cloud-init 22.2.2 in Amazon Linux 2023 add
addresses amazonlinux/amazon-linux-2023#401

Signed-off-by: Noah Meyerhans <[email protected]>
  • Loading branch information
Noah Meyerhans committed Jul 14, 2023
1 parent ff1c02f commit bfc7d96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cloudinit/sources/DataSourceEc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,13 +567,14 @@ def crawl_metadata(self):
else:
exc_cb = exc_cb_ud = skip_cb = None
try:
crawled_metadata["user-data"] = ec2.get_instance_userdata(
raw_userdata = ec2.get_instance_userdata(
api_version,
self.metadata_address,
headers_cb=self._get_headers,
headers_redact=redact,
exception_cb=exc_cb_ud,
)
crawled_metadata["user-data"] = util.maybe_b64decode(raw_userdata)
crawled_metadata["meta-data"] = ec2.get_instance_metadata(
api_version,
self.metadata_address,
Expand Down

0 comments on commit bfc7d96

Please sign in to comment.