forked from tinkerbell/tink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hardware not found response (tinkerbell#365)
## Description <!--- Please describe what this PR is going to change --> When getting hardware and hardware is not found, the error `unexpected end of JSON input` is no longer returned. The error returned will be a `hardware not found: sql: no rows in result set` instead. In addition, the error message received when trying to create a workflow with a worker/hardware not present in the database is now: ``` 2020/11/18 21:24:01 rpc error: code = Unknown desc = failed to create workflow: unable to insert into action list: no worker found: mac: b4:96:91:5f:ac:00 ``` ## Why is this needed <!--- Link to issue you have raised --> The error message was vague and misleading. Error message before (as seen in boots): ``` boots_1 | {"level":"info","ts":1605204343.6437285,"caller":"src/dhcp.go:76","msg":"retrieved job is empty","service":"github.com/tinkerbell/boots","pkg":"main","type":"DHCPDISCOVER","mac":"f8:f2:1e:a6:cd:10","err":"discover from dhcp message: get hardware by mac from tink: rpc error: code = Unknown desc = unexpected end of JSON input","errVerbose":"rpc error: code = Unknown desc = unexpected end of JSON input\nget hardware by mac from tink\ngithub.com/tinkerbell/boots/packet. ... ``` Error message after: ``` boots_1 | {"level":"info","ts":1605289315.5323317,"caller":"myapp/dhcp.go:76","msg":"retrieved job is empty","service":"github.com/tinkerbell/boots","pkg":"main","type":"DHCPDISCOVER","mac":"b4:96:91:5f:ac:e0","err":"discover from dhcp message: get hardware by mac from tink: rpc error: code = Unknown desc = sql: no rows in result set","errVerbose":"rpc error: code = Unknown desc = sql: no rows in result set\nget hardware by mac from tink\ngithub.com/tinkerbell/boots/packet.. ... ``` (I know, sorry for the bad formatting) ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> Manually ## How are existing users impacted? What migration steps/scripts do we need? <!--- Fixes a bug, unblocks installation, removes a component of the stack etc --> <!--- Requires a DB migration script, etc. --> N/A ## Checklist: I have: - [ ] updated the documentation and/or roadmap (if required) - [ ] added unit or e2e tests - [ ] provided instructions on how to upgrade
- Loading branch information
Showing
5 changed files
with
78 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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