Skip to content

sources/azure: always initialize _ephemeral_dhcp_ctx on unpickle#1199

Merged
TheRealFalcon merged 2 commits into
canonical:mainfrom
cjp256:azure-unpickle-ephemeral-dhcp-ctx
Jan 20, 2022
Merged

sources/azure: always initialize _ephemeral_dhcp_ctx on unpickle#1199
TheRealFalcon merged 2 commits into
canonical:mainfrom
cjp256:azure-unpickle-ephemeral-dhcp-ctx

Conversation

@cjp256
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

@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