launcher
launcher copied to clipboard
remove the invalid boolean from all the service responses
Right now a launcher client/server method looks something like this
func(svc) someFunc(nodeKey) (invalid bool, err err) {
invalid, err := authenticate(nodeKey)
if err != nil { return invalid, err}
err = someOtherCall()
if err != nil { return false, err}
....
(repeated many times, invalid is always false)
}
Because invalid
is only true for certain authentication errors it should not be a required return argument. after the first auth call, invalid is always false.
Instead, we can use a specific error type similar to the one in fleet:
type osqueryError struct {
message string
nodeInvalid bool
}
func (e osqueryError) Error() string {
return e.message
}
func (e osqueryError) NodeInvalid() bool {
return e.nodeInvalid
}
removing the invalid bool
from the Go methods would make this parameter something that's a transport level concern and would allow us to refactor authenticateHost
calls to an endpoint middleware.
Anyway, that's my 2c. Curious if you have any strong feelings one way or another @zwass
Also the error in CheckHealth (maybe)
![screen shot 2017-10-24 at 7 53 54 pm](https://user-images.githubusercontent.com/1526945/31973638-20e9b5bc-b8f5-11e7-9bde-8a08b3c68158.png)
While we might redo some protocol and interfaces, I don't think we're going to go in this direction