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

when keys not found in redis, return NotFoundError #126

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

deitch
Copy link
Contributor

@deitch deitch commented Jun 6, 2024

The file and memory driver distinguish between actual errors and things that are not found by returning a common.NotFoundError, which the admin handler check for.

The redis driver does not; for everything that it fails to get, it just returns an error.

The net result, e.g, is if you look up a certificate for a device that does not exist, with the memory or file driver, adam will return a 404, while the redis driver will return a 400, which is incorrect. Downstream things like eden then think it is an error, rather than something just not found yet.

This adds NotFoundError to places in redis where HGet and its variants return redis.Nil, which means, "I could not find the key."

Copy link
Collaborator

@giggsoff giggsoff left a comment

Choose a reason for hiding this comment

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

I am not sure, but will we hit the same problem with calls to readCert function for example in DeviceGet?

pkg/driver/redis/device_manager_redis.go Outdated Show resolved Hide resolved
pkg/driver/redis/device_manager_redis.go Outdated Show resolved Hide resolved
@deitch deitch merged commit a564a92 into lf-edge:master Jun 6, 2024
2 checks passed
@deitch deitch deleted the fix-get-return-codes branch June 6, 2024 12:43
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.

2 participants