This repository was archived by the owner on Aug 19, 2019. It is now read-only.
Don't add labels to container metadata if the pod has no labels.#48
Merged
igorpeshansky merged 2 commits intomasterfrom Jan 4, 2018
Merged
Don't add labels to container metadata if the pod has no labels.#48igorpeshansky merged 2 commits intomasterfrom
igorpeshansky merged 2 commits intomasterfrom
Conversation
igorpeshansky
suggested changes
Jan 3, 2018
| try { | ||
| labels = metadata->Get<json::Object>("labels"); | ||
| } catch (const json::Exception& e) { | ||
| labels = new json::Object({}); |
Contributor
There was a problem hiding this comment.
This will leak. Let's instead handle it by not sending the "labels" component at all...
| const std::string created_str = | ||
| metadata->Get<json::String>("creationTimestamp"); | ||
| Timestamp created_at = rfc3339::FromString(created_str); | ||
| const json::Object* labels = metadata->Get<json::Object>("labels"); |
Contributor
There was a problem hiding this comment.
Might as well also delete this from line 199...
…as labels. Use a Has test instead of catching the exception.
Contributor
Author
|
Your changes LGTM. |
igorpeshansky
approved these changes
Jan 3, 2018
Contributor
igorpeshansky
left a comment
There was a problem hiding this comment.
Feels weird approving my own changes, but you've already LGTM'd them.
| const std::string created_str = | ||
| metadata->Get<json::String>("creationTimestamp"); | ||
| Timestamp created_at = rfc3339::FromString(created_str); | ||
| const json::Object* labels = metadata->Get<json::Object>("labels"); |
| try { | ||
| labels = metadata->Get<json::Object>("labels"); | ||
| } catch (const json::Exception& e) { | ||
| labels = new json::Object({}); |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.