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

Fix: GCE _get_data crashes if DHCP lease fails (#5997) #5998

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bryanfraschetti
Copy link
Contributor

This commit addresses issue #5997 which reported crashes in init-local when cloud-init was examining GCELocal as a potential datasource. When all NICs failed at DHCP discovery cloud-init attempts to log the events by dereferencing a value that was never assigned.

This commit modifies the _get_data function of DataSourceGCE.py by adding an empty dictionary definition for the ret variable at the top level of the function and some debugging logs when a candidate NIC fails to obtain a DHCP lease. At the same time, the commit replaces the direct key access operator on ret with the safe lookup method get(). This commit also adds a unit test that mocks the observed situation

Fixes GH-5997

This commit addresses issue canonical#5997 which reported crashes in init-local
when cloud-init was examining GCELocal as a potential datasource. When
all NICs failed at DHCP discovery cloud-init attempts to log the events
by dereferencing a value that was never assigned.

This commit modifies the _get_data function of DataSourceGCE.py by
adding an empty dictionary definition for the ret variable at the
top level of the function and some debugging logs when a candidate NIC
fails to obtain a DHCP lease. At the same time, the commit replaces the
direct key access operator on ret with the safe lookup method get(). This
commit also adds a unit test that mocks the observed situation
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.

GCE datasource crashes if no NIC is able to obtain a DHCP lease
1 participant