Files
akyldash/infra/bootstrap/host-guard.sh
agent 16f97d5f73
CI / tests-and-images (pull_request) Has been cancelled
Guard recovery bootstrap from production host
2026-10-11 19:16:54 +03:00

12 lines
406 B
Bash

akyldash_is_production_host() {
local hostname=${1:-}
local ipv4_addresses=${2:-}
if [[ -z $hostname ]]; then
hostname=$(hostname -f 2>/dev/null || true)
fi
if [[ -z $ipv4_addresses ]]; then
ipv4_addresses=$(ip -o -4 addr show 2>/dev/null | awk '{split($4, address, "/"); print address[1]}')
fi
[[ $hostname == avprogs.hlab.kz ]] || grep -Fqx '206.223.249.118' <<<"$ipv4_addresses"
}