Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev2/edge/edge-box
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ def restore_live(tgz):
keep = {"etc/caddy/Caddyfile", "etc/caddy/edge-cert-sources", "etc/nginx/stream-enabled/dev2-edge.conf", C0MPUTE_HTTP}
with tarfile.open(tgz) as tf:
members = [m for m in tf.getmembers() if m.name in keep]
tf.extractall("/", members=members, **({"filter": "fully_trusted"} if hasattr(tarfile, "data_filter") else {}))
# Not in the backup means this run added it: take it away again.
if C0MPUTE_HTTP not in {m.name for m in members} and os.path.exists("/" + C0MPUTE_HTTP):
os.remove("/" + C0MPUTE_HTTP)
tf.extractall("/", members=members, **({"filter": "fully_trusted"} if hasattr(tarfile, "data_filter") else {}))
run("nginx -t -q", capture=True)
run("systemctl reload nginx")
run("if systemctl is-active --quiet caddy.service; then systemctl reload caddy.service; else systemctl restart caddy.service; fi")
Expand Down
7 changes: 4 additions & 3 deletions dev2/edge/edge-sweep
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ if [ "${1:-}" = "--names" ]; then
exit 0
fi

[ -f "${1:-}" ] || { echo "usage: edge-sweep NAMES_FILE | --names" >&2; exit 2; }
probe() {
n="$1"
# Verified first; only when that fails (000: no answer, or a certificate this box
Expand All @@ -39,6 +38,8 @@ probe() {
h=$(curl -s -o /dev/null -m "$TIMEOUT" -w '%{http_code}' --resolve "$n:80:$IP" "$plain://$n/" 2>/dev/null) || true
printf '%s\t%s\t%s\t%s\n' "$n" "${v:-000}" "${k:-000}" "${h:-000}"
}
# POSIX sh has no `export -f`: xargs re-enters this script once per name.
if [ "${EDGE_SWEEP_ONE:-}" ]; then probe "$EDGE_SWEEP_ONE"; exit 0; fi
# POSIX sh has no `export -f`: xargs re-enters this script once per name (and
# edge-box's re-probe calls it the same way, with /dev/null, which is not a file).
[ -z "${EDGE_SWEEP_ONE:-}" ] || { probe "$EDGE_SWEEP_ONE"; exit 0; }
[ -f "${1:-}" ] || { echo "usage: edge-sweep NAMES_FILE | --names" >&2; exit 2; }
grep -v '^[[:space:]]*$' "$1" | xargs -P "$JOBS" -I{} env EDGE_SWEEP_ONE={} sh "$0" "$1" | sort
Loading