NetVM: agent-friendly exec primitive (local + fleet)

This commit is contained in:
Antigravity Agent
2026-10-03 01:05:35 -04:00
parent d39057fc99
commit 9f76e30ff9
2 changed files with 24 additions and 1 deletions
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# netvm-exec.sh <node> -- <cmd> [args...] — run a command inside the node's
# netns as the invoking user. The agent-friendly primitive for "do X in the
# node's network": egress tests, automation, debugging.
# (The node must be up; see netvm-node-up.sh / netvm-fleet.sh up.)
set -euo pipefail
NETVM_BIN="$(cd "$(dirname "$0")" && pwd)"
NODE="${1:?usage: netvm-exec.sh <node> -- <cmd> [args...]}"; shift
[ "${1:-}" = "--" ] && shift
[ $# -gt 0 ] || { echo "usage: netvm-exec.sh <node> -- <cmd> [args...]"; exit 1; }
[ -f "/etc/netvm/${NODE}.conf" ] || { echo "no warp identity for '$NODE' (human: netvm-new-identity.sh $NODE)"; exit 1; }
ip netns list 2>/dev/null | grep -q "^warp-${NODE}" || { echo "node '$NODE' is not up (netvm-node-up.sh $NODE)"; exit 1; }
exec sudo -n "$NETVM_BIN/netvm-enter.sh" "$NODE" "$(id -u)" "$(id -g)" "$HOME" -- "$@"