Skip to content

fix(scaleway): prevent crash on missing metadata keys (#6602) - #6608

Closed
ffeldhaus wants to merge 2 commits into
canonical:mainfrom
ffeldhaus:main
Closed

fix(scaleway): prevent crash on missing metadata keys (#6602)#6608
ffeldhaus wants to merge 2 commits into
canonical:mainfrom
ffeldhaus:main

Conversation

@ffeldhaus

Copy link
Copy Markdown

Proposed Commit Message

fix(scaleway): prevent crash on missing metadata keys (#6602)

Use safe .get() access for private_ip and ipv6 metadata fields to avoid KeyErrors when these optional fields are missing.

Additionally:

  • Ensure ipv6 is treated as a dictionary and check for existence of required keys (address, netmask, gateway) before usage.
  • Safely iterate over public_ips defaulting to an empty list.

Added unit tests to cover scenarios with missing keys and empty configurations.

Fixes GH-6602

Test Steps

Unit Tests added to tests/unittests/sources/test_scaleway.py.

Merge type

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

Use safe `.get()` access for `private_ip` and `ipv6` metadata fields to
avoid KeyErrors when these optional fields are missing.

Additionally:
- Ensure `ipv6` is treated as a dictionary and check for existence of
  required keys (`address`, `netmask`, `gateway`) before usage.
- Safely iterate over `public_ips` defaulting to an empty list.

Added unit tests to cover scenarios with missing keys and empty
configurations.

Fixes: #6602
@holmanb

holmanb commented Dec 8, 2025

Copy link
Copy Markdown
Member

@karibou fyi

Comment thread cloudinit/sources/DataSourceScaleway.py
@holmanb holmanb self-assigned this Dec 8, 2025
@NoSuchCommand

Copy link
Copy Markdown
Contributor

Obsoleted by #6617

@ffeldhaus ffeldhaus closed this Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scaleway datasource tries to access missing keys in metadata

3 participants