Skip to content

Commit

Permalink
fix(hatchery/local): check requirement os/arch
Browse files Browse the repository at this point in the history
This is must have if:
- osDefault != osHatchery
- provision 0 on hatchery local

Signed-off-by: Yvonnick Esnault <yvonnick@esnau.lt>
  • Loading branch information
yesnault committed Jun 13, 2019
1 parent 9027433 commit 33f6bfb
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions engine/hatchery/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,12 @@ func (h *HatcheryLocal) checkRequirement(r sdk.Requirement) (bool, error) {
return true, nil
case sdk.PluginRequirement:
return true, nil
case sdk.OSArchRequirement:
osarch := strings.Split(r.Value, "/")
if len(osarch) != 2 {
return false, fmt.Errorf("invalid requirement %s", r.Value)
}
return osarch[0] == strings.ToLower(sdk.GOOS) && osarch[1] == strings.ToLower(sdk.GOARCH), nil
default:
return false, nil
}
Expand Down

0 comments on commit 33f6bfb

Please sign in to comment.