Files
proxmox/scripts/lib/proxmox-api.sh.bak
defiQUG fbda1b4beb
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
docs: Ledger Live integration, contract deploy learnings, NEXT_STEPS updates
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands
- CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround
- CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check
- NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere
- MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates
- LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 15:46:57 -08:00

57 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Shared Proxmox API Module
# Provides common Proxmox API helper functions
# Usage: source "$(dirname "${BASH_SOURCE[0]}")/../lib/proxmox-api.sh"
# Source dependencies
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/ip-config.sh" 2>/dev/null || true
source "$SCRIPT_DIR/logging.sh" 2>/dev/null || true
# Proxmox API functions
proxmox_api_call() {
local method="${1:-GET}"
local endpoint="${2:-}"
local data="${3:-}"
local host="${4:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if [ -z "$endpoint" ]; then
log_error "Proxmox API endpoint required"
return 1
fi
# Use token or password authentication
if [ -n "${PROXMOX_TOKEN:-}" ]; then
curl -s -X "$method" \
-H "Authorization: PVEAPIToken=$PROXMOX_TOKEN" \
-H "Content-Type: application/json" \
${data:+-d "$data"} \
"https://$host:8006/api2/json$endpoint"
else
log_warn "Proxmox token not configured, API calls may fail"
return 1
fi
}
# Check container status
check_container_status() {
local vmid="${1:-}"
local host="${2:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
if [ -z "$vmid" ]; then
log_error "VMID required"
return 1
fi
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host" \
"pct status $vmid 2>/dev/null | awk '{print \$2}'" || echo "unknown"
}
# List containers on host
list_containers() {
local host="${1:-${PROXMOX_HOST_ML110:-192.168.11.10}}"
ssh -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@"$host" \
"pct list" 2>/dev/null || echo ""
}