worker: require workers to declare job types they accept
For now, workers must send `[ "osbuild" ]`.
This commit is contained in:
parent
d3c99b8e93
commit
ba6a480e32
5 changed files with 21 additions and 4 deletions
|
|
@ -252,12 +252,16 @@ func (h *apiHandlers) GetStatus(ctx echo.Context) error {
|
|||
}
|
||||
|
||||
func (h *apiHandlers) RequestJob(ctx echo.Context) error {
|
||||
var body struct{}
|
||||
var body api.RequestJobJSONRequestBody
|
||||
err := ctx.Bind(&body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(body.Types) != 1 || body.Types[0] != "osbuild" {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "invalid job types")
|
||||
}
|
||||
|
||||
token, jobId, jobArgs, err := h.server.RequestJob(ctx.Request().Context())
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue