recwatch: Fix watching newly created files on macOS
Fixes: https://github.com/purpleidea/mgmt/issues/33
This commit is contained in:
committed by
James Shubin
parent
318fe4a5dc
commit
9544ab2e02
@@ -134,9 +134,8 @@ discouraged either). Meaning it might work but in the case it doesn't you would
|
||||
have to provide your own patches to fix problems (the project maintainer and
|
||||
community are glad to assist where needed).
|
||||
|
||||
There are currently some issues that make `mgmt` less suitable to run for
|
||||
provisioning macOS (eg: [https://github.com/purpleidea/mgmt/issues/33](https://github.com/purpleidea/mgmt/issues/33)).
|
||||
But as a client to provision remote servers it should run fine.
|
||||
There are currently some issues that make `mgmt` less suitable to run for provisioning
|
||||
macOS. But as a client to provision remote servers it should run fine.
|
||||
|
||||
Since the primary supported systems are Linux and these are the environments
|
||||
tested for it is wise to run these suites during macOS development as well. To
|
||||
|
||||
@@ -47,7 +47,7 @@ if [ ! -z "$APT" ]; then
|
||||
fi
|
||||
|
||||
if [ ! -z "$BREW" ]; then
|
||||
# coreutils contains gtimeout
|
||||
# coreutils contains gtimeout, gstat, etc
|
||||
$BREW install libvirt augeas coreutils || true
|
||||
fi
|
||||
|
||||
|
||||
@@ -159,8 +159,8 @@ func (obj *RecWatcher) Watch() error {
|
||||
if obj.Flags.Debug {
|
||||
log.Printf("watcher.Add(%s): Error: %v", current, err)
|
||||
}
|
||||
|
||||
if err == syscall.ENOENT {
|
||||
// ENOENT for linux, etc and IsNotExist for macOS
|
||||
if err == syscall.ENOENT || os.IsNotExist(err) {
|
||||
index-- // usually not found, move up one dir
|
||||
index = int(math.Max(1, float64(index)))
|
||||
continue
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
# https://github.com/purpleidea/mgmt/issues/33
|
||||
echo "This test is broken on macOS, skipping!"
|
||||
exit
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
. ../util.sh
|
||||
|
||||
# run till completion
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --yaml file-mode.yaml --converged-timeout=5 --no-watch --tmp-prefix &
|
||||
pid=$!
|
||||
@@ -19,7 +15,7 @@ ls -l /tmp/mgmt
|
||||
test -e /tmp/mgmt/f1
|
||||
test -e /tmp/mgmt/f2
|
||||
test -e /tmp/mgmt/f3
|
||||
test $(stat -c%a /tmp/mgmt/f2) = 741
|
||||
test $(stat -c%a /tmp/mgmt/f3) = 614
|
||||
test $($STAT -c%a /tmp/mgmt/f2) = 741
|
||||
test $($STAT -c%a /tmp/mgmt/f3) = 614
|
||||
|
||||
exit $e
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
# https://github.com/purpleidea/mgmt/issues/33
|
||||
echo "This test is broken on macOS, skipping!"
|
||||
exit
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/mgmt/
|
||||
rm /tmp/mgmt/f1 || true
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if env | grep -q -e '^TRAVIS=true$' && [[ $(uname) == "Darwin" ]]; then
|
||||
if env | grep -q -e '^TRAVIS=true$'; then
|
||||
# loadavg glibc calls don't seem to work properly on osx OS in travis
|
||||
echo "Travis and Jenkins give wonky results here, skipping test!"
|
||||
exit
|
||||
@@ -18,9 +18,6 @@ regex="load average: [0-9]\,[0-9]{3,}, [0-9]\,[0-9]{3,}, [0-9]\,[0-9]{3,}"
|
||||
|
||||
tmpdir="$($mktemp --tmpdir -d tmp.XXX)"
|
||||
|
||||
# macOS workaround https://github.com/purpleidea/mgmt/issues/33
|
||||
touch "$tmpdir/loadavg"
|
||||
|
||||
cat > "$tmpdir/load0.mcl" <<EOF
|
||||
\$theload = load()
|
||||
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
# https://github.com/purpleidea/mgmt/issues/33
|
||||
echo "This test is broken on macOS, skipping!"
|
||||
exit
|
||||
fi
|
||||
|
||||
# run a graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --no-pgp --prometheus --yaml prometheus-3.yaml &
|
||||
pid=$!
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
# https://github.com/purpleidea/mgmt/issues/33
|
||||
echo "This test is broken on macOS, skipping!"
|
||||
exit
|
||||
fi
|
||||
|
||||
# run a graph, with prometheus support
|
||||
$timeout --kill-after=60s 55s "$MGMT" run --tmp-prefix --no-pgp --prometheus --yaml prometheus-4.yaml &
|
||||
pid=$!
|
||||
|
||||
@@ -11,9 +11,11 @@ export MGMT="$ROOT/mgmt"
|
||||
if [[ $(uname) == "Darwin" ]] ; then
|
||||
export timeout="gtimeout"
|
||||
export mktemp="gmktemp"
|
||||
export STAT="gstat"
|
||||
else
|
||||
export timeout="timeout"
|
||||
export mktemp="mktemp"
|
||||
export STAT="stat"
|
||||
fi
|
||||
|
||||
fail_test()
|
||||
|
||||
Reference in New Issue
Block a user