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

Use dig, not direct indexing for field that may not exist in RestartTask #841

Merged
merged 3 commits into from
Nov 15, 2021

Conversation

timothysmith0609
Copy link
Contributor

@timothysmith0609 timothysmith0609 commented Nov 15, 2021

When invoking the restart task via annotations, krane iterates over all resources in the namespace in search of the restart annotation. However, not all resources may define an annotations field in their metadata, and krane currently indexes into annotations via []. This causes a NoMethodError since annotations is nil.

This PR changes the raw indexing to using #dig, instead. The current CI suite captures the fact that this change is valid.

@timothysmith0609 timothysmith0609 requested a review from a team as a code owner November 15, 2021 15:49
Copy link
Contributor

@jessie-JNing jessie-JNing left a comment

Choose a reason for hiding this comment

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

LGTM

@timothysmith0609 timothysmith0609 merged commit 7510c33 into master Nov 15, 2021
@timothysmith0609 timothysmith0609 deleted the restart_fixes branch November 15, 2021 18:41
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.

None yet

2 participants