Update to nomad-0.10.4.

This commit is contained in:
ajacoutot 2020-02-21 12:20:51 +00:00
parent 13bacd5d50
commit 2c87d7ed96
4 changed files with 71 additions and 4 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.13 2020/02/08 11:35:07 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.14 2020/02/21 12:20:51 ajacoutot Exp $
# bunch of undefined things in crypto/blake2b, shirou/gopsutil/disk, shirou/gopsutil/mem
NOT_FOR_ARCHS= i386
COMMENT= cluster scheduler
GH_TAGNAME= v0.10.3
GH_TAGNAME= v0.10.4
GH_ACCOUNT= hashicorp
GH_PROJECT= nomad
@ -22,6 +22,9 @@ WANTLIB += c pthread
MODULES= lang/go
post-extract:
cp ${FILESDIR}/*.go ${WRKDIST}/helper/freeport
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/nomad
${SUBST_CMD} -c -m 0640 ${FILESDIR}/nomad.hcl \

View File

@ -1,2 +1,2 @@
SHA256 (nomad-0.10.3.tar.gz) = lZy79RWP8gwpk0EO9GTU7gTMXNAfIi78IJL6orzGaJ4=
SIZE (nomad-0.10.3.tar.gz) = 39981341
SHA256 (nomad-0.10.4.tar.gz) = jyFlIGItoJQyfKpbbifgKYu9aHeMe5n0NqFtY5ERD5k=
SIZE (nomad-0.10.4.tar.gz) = 43766289

View File

@ -0,0 +1,46 @@
//+build openbsd
package freeport
import (
"fmt"
"os/exec"
"regexp"
"strconv"
)
/*
$ sysctl net.inet.ip.porthifirst net.inet.ip.porthilast
net.inet.ip.porthifirst=49152
net.inet.ip.porthilast=65535
*/
const (
ephPortFirst = "net.inet.ip.porthifirst"
ephPortLast = "net.inet.ip.porthilast"
command = "sysctl"
)
var ephPortRe = regexp.MustCompile(`^\s*(\d+)\s+(\d+)\s*$`)
func getEphemeralPortRange() (int, int, error) {
cmd := exec.Command(command, "-n", ephPortFirst, ephPortLast)
out, err := cmd.Output()
if err != nil {
return 0, 0, err
}
val := string(out)
m := ephPortRe.FindStringSubmatch(val)
if m != nil {
min, err1 := strconv.Atoi(m[1])
max, err2 := strconv.Atoi(m[2])
if err1 == nil && err2 == nil {
return min, max, nil
}
}
return 0, 0, fmt.Errorf("unexpected sysctl value %q for keys %q %q", val, ephPortFirst, ephPortLast)
}

View File

@ -0,0 +1,18 @@
//+build openbsd
package freeport
import (
"testing"
)
func TestGetEphemeralPortRange(t *testing.T) {
min, max, err := getEphemeralPortRange()
if err != nil {
t.Fatalf("err: %v", err)
}
if min <= 0 || max <= 0 || min > max {
t.Fatalf("unexpected values: min=%d, max=%d", min, max)
}
t.Logf("min=%d, max=%d", min, max)
}