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)
https://github.com/kolide/fleet/pull/1582
While we might redo some protocol and interfaces, I don't think we're going to go in this direction