Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sources/azure: always initialize _ephemeral_dhcp_ctx on unpickle #1199

Merged

Conversation

cjp256
Copy link
Contributor

@cjp256 cjp256 commented Jan 19, 2022

Avoid requirement of getattr() and ensure _ephemeral_dhcp_ctx isn't
persisted in the cache.

Signed-off-by: Chris Patterson cpatterson@microsoft.com

Avoid requirement of getattr() and ensure _ephemeral_dhcp_ctx isn't
persisted in the cache.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
) and getattr(self, "_ephemeral_dhcp_ctx", None)
use_cached_ephemeral = (
self.distro.networking.is_up(self.fallback_interface)
and self._ephemeral_dhcp_ctx
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check for self._ephemeral_dhcp_ctx.lease here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In practice I expect that a NoDHCPLeaseError exception would have been raised and prevented it from getting this far.

I added an explicit check and I have other PRs in queue to further improve this handling.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TheRealFalcon TheRealFalcon merged commit 109c2bb into canonical:main Jan 20, 2022
@cjp256 cjp256 deleted the azure-unpickle-ephemeral-dhcp-ctx branch April 25, 2022 16:51
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.

3 participants