Skip to content

kubelet-config: fix variable shadowing#603

Merged
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
runcom:fix-err-shadowing
Apr 8, 2019
Merged

kubelet-config: fix variable shadowing#603
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
runcom:fix-err-shadowing

Conversation

@runcom
Copy link
Copy Markdown
Member

@runcom runcom commented Apr 4, 2019

Otherwise, we were only adding nil as Conditions even when there was an
actual error...

@rphillips ptal, maybe this function should be split in 2 and unit tests added to catch stuff like this..

Signed-off-by: Antonio Murdaca runcom@linux.com

Otherwise, we were only adding nil as Conditions even when there was an
actual error...

Signed-off-by: Antonio Murdaca <runcom@linux.com>
@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 4, 2019
if getErr != nil {
return getErr
}
newcfg.Status.Conditions = append(newcfg.Status.Conditions, wrapErrorWithCondition(err, args...))
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

and maybe this needs to be wrapped in a if err != nil to avoid reporting nothing?

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.

wrapErrorWithCondition returns Success if error = nil (https://github.com/openshift/machine-config-operator/blob/master/pkg/controller/kubelet-config/helpers.go#L119).
So to me it looks like it'll always append a new condition here and we don't need to avoid this step,

Copy link
Copy Markdown
Contributor

@LorbusChris LorbusChris Apr 4, 2019

Choose a reason for hiding this comment

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

ah but looks like the return below ends up making the syncHandler return nil on no-error runs. Maybe we want to report a success/no errors msg here?

@runcom runcom mentioned this pull request Apr 4, 2019
@LorbusChris
Copy link
Copy Markdown
Contributor

looks like apiserver didn't come up in e2e

/test e2e-aws

@kikisdeliveryservice
Copy link
Copy Markdown
Contributor

I agree with @runcom that this function should be split and add that comments should be added to make this easier to understand at a glance.

@rphillips
Copy link
Copy Markdown
Contributor

/lgtm

I'll look into improving that status reporting.

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 8, 2019
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rphillips, runcom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit e79ae92 into openshift:master Apr 8, 2019
@runcom runcom deleted the fix-err-shadowing branch April 8, 2019 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants