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

[main/vlan] Fix error handling for delegate IPAM plugin #568

Merged
merged 1 commit into from
Jan 20, 2021
Merged

Conversation

jellonek
Copy link
Member

At the moment error messages generated during execution of delegate IPAM plugin are indistinguishable from main vlan messages leading to cryptic messages like no plugin name provided which IS hard to debug from a human operator level.
This PR fixes that behavior.

Signed-off-by: Piotr Skamruk <piotr.skamruk@gmail.com>
@@ -152,7 +152,7 @@ func cmdAdd(args *skel.CmdArgs) error {
// run the IPAM plugin and get back the config to apply
r, err := ipam.ExecAdd(n.IPAM.Type, args.StdinData)
if err != nil {
return err
return fmt.Errorf("failed to execute IPAM delegate: %v", err)
Copy link

Choose a reason for hiding this comment

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

NIT: It is a good practice to use %w instead of %v when adding additional context to errors to keep the original error type.
https://golang.org/pkg/fmt/#Errorf

Copy link
Member Author

@jellonek jellonek Jan 14, 2021

Choose a reason for hiding this comment

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

hint: check the convention used in the rest of the repo.
Fill welcomed to provide such change globally ;)

Copy link
Member

@mars1024 mars1024 left a comment

Choose a reason for hiding this comment

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

/lgtm

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

4 participants