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
Check that there are extra fields and not fields explicitly false #12804
Check that there are extra fields and not fields explicitly false #12804
Conversation
When we check for extra fields, we check only check for byte equality. But because of omitEmpty, fields set explicitly to false are removed, which cause a diff of removed line. This change will ignore these removed lines.
/retest |
err := yaml.UnmarshalStrict([]byte(yamlString), &editedClusterObj) | ||
if err == nil { | ||
return "", nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we also need to handle kops.InstanceGroup
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do.
There is very little testing around this. I think we should consolidate some of the logic in the edit commands with the replace command. Typos in yaml passed to replace is also a fairly common source of bugs.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johngmyers The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
When we check for extra fields, we check only check for byte equality. But because of omitEmpty, fields set explicitly to false are removed, which cause a diff of removed line. This change introduces an actual strict unmarshal to ensure all the fields are known. Then it continues with the existing logic to preserve the output.