cloud-init icon indicating copy to clipboard operation
cloud-init copied to clipboard

feat(digitalocean): Add support for base64-encoded user-data

Open zoispag opened this issue 6 months ago • 1 comments

Proposed Commit Message

feat(digitalocean): Add support for base64-encoded user-data

Updated DataSourceDigitalOcean to decode user_data using `util.maybe_b64decode()`. A unit test was added to verify the correct handling of base64-encoded user data.

Additional Context

Trying to use user-data provided by Terraform with base64_encode = true, I received the following error:

# /var/log/cloud-init-output.log
2025-06-24 13:37:13,389 - __init__.py[WARNING]: Unhandled non-multipart (text/x-not-multipart) userdata: 'b'Q29udGVudC1UeXBlOiBtdWx0'...'

This PR uses util.maybe_b64decode() similar to EC2 and Hetzner, to "potentially" decode base64-encoded user data.

Test Steps

Merge type

  • [x] Squash merge using "Proposed Commit Message"
  • [ ] Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

zoispag avatar Jun 24 '25 20:06 zoispag

As the DigitalOcean data source has been deprecated (#4194) since cloud-init 23.2, in preference to the ConfigDrive data source, is there any point in applying this change?

dermotbradley avatar Jun 25 '25 00:06 dermotbradley

Hello! Thank you for this proposed change to cloud-init. This pull request is now marked as stale as it has not seen any activity in 14 days. If no activity occurs within the next 7 days, this pull request will automatically close.

If you are waiting for code review and you are seeing this message, apologies! Please reply, tagging TheRealFalcon, and he will ensure that someone takes a look soon.

(If the pull request is closed and you would like to continue working on it, please do tag TheRealFalcon to reopen it.)

github-actions[bot] avatar Jul 10 '25 00:07 github-actions[bot]