Catch InvalidDHCPLeaseFileError in DataSourceScaleway._get_data to prevent crash on IPv6-only VMs.#6904
Open
Federicorao wants to merge 2 commits into
Open
Conversation
holmanb
requested changes
Jun 12, 2026
holmanb
left a comment
Member
There was a problem hiding this comment.
Please fix failing tests and sign the CLA.
Author
|
I have signed the Canonical CLA. Please re-check the CLA status and re-review the latest commit. |
holmanb
requested changes
Jun 22, 2026
| return False | ||
|
|
||
| def _get_data(self): | ||
|
|
Member
There was a problem hiding this comment.
please avoid unnecessary whitespace changes
Comment on lines
+309
to
+332
| # Methods required by the DataSource base class | ||
| def get_instance_id(self): | ||
| if not self.metadata: | ||
| return None | ||
| return self.metadata.get("id") | ||
|
|
||
| def get_hostname(self, fqdn=False, resolve_ip=False, metadata_only=False): | ||
| if not self.metadata: | ||
| return DataSourceHostname(None, True) | ||
| hostname = self.metadata.get("hostname") | ||
| if hostname: | ||
| return DataSourceHostname(hostname, False) | ||
| return DataSourceHostname(None, True) | ||
|
|
||
| def get_public_ssh_keys(self): | ||
| if not self.metadata: | ||
| return [] | ||
| keys = [] | ||
| for entry in self.metadata.get("ssh_public_keys", []): | ||
| if isinstance(entry, dict): | ||
| keys.append(entry["key"]) | ||
| for tag in self.metadata.get("tags", []): | ||
| if tag.startswith("AUTHORIZED_KEY="): | ||
| key = tag.split("=", 1)[1].replace("_", " ") |
Member
There was a problem hiding this comment.
please avoid relocating existing code
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.
Fixes #6901.
What changed
Catch InvalidDHCPLeaseFileError in DataSourceScaleway._get_data to prevent crash on IPv6-only VMs.
Why
On IPv6-only Scaleway VMs, dhcpcd returns an empty lease, which raises InvalidDHCPLeaseFileError. This exception was not caught in the except block of
_get_data, causing an unhandled crash. The fix adds InvalidDHCPLeaseFileError to the import and the except clause, matching how other datasources handle this error.Verification
Not run
Changed files
cloudinit/sources/DataSourceScaleway.py