feat(preflight): add enterprise repo subscription check
- New preflight_repo_access() warns if enterprise repos are active without subscription - Scans /etc/apt/sources.list.d/ for enterprise.proxmox.com entries - Tests HTTP access (detects 401/403 Unauthorized) - Warning only — not a blocker (packages come from pve-no-subscription repo)
This commit is contained in:
@@ -113,6 +113,7 @@ fi
|
|||||||
# - Kernel: keyring limits (maxkeys/maxbytes for UID 100000)
|
# - Kernel: keyring limits (maxkeys/maxbytes for UID 100000)
|
||||||
# - Storage: rootdir support, vztmpl support, available space
|
# - Storage: rootdir support, vztmpl support, available space
|
||||||
# - Network: bridge availability, DNS resolution
|
# - Network: bridge availability, DNS resolution
|
||||||
|
# - Repos: enterprise repo subscription validation
|
||||||
# - Cluster: quorum status (if clustered)
|
# - Cluster: quorum status (if clustered)
|
||||||
# - Proxmox: LXC stack health, container ID availability
|
# - Proxmox: LXC stack health, container ID availability
|
||||||
# - Template: download server reachability
|
# - Template: download server reachability
|
||||||
@@ -348,6 +349,42 @@ preflight_dns_resolution() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# preflight_repo_access()
|
||||||
|
#
|
||||||
|
# - Checks if Proxmox enterprise repos are enabled without a valid subscription
|
||||||
|
# - Scans /etc/apt/sources.list.d/ for enterprise.proxmox.com entries
|
||||||
|
# - Tests HTTP access to detect 401 Unauthorized
|
||||||
|
# - Warning only (not a blocker — packages come from no-subscription repo)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
preflight_repo_access() {
|
||||||
|
local enterprise_files
|
||||||
|
enterprise_files=$(grep -rlE '^\s*deb\s+https://enterprise\.proxmox\.com' /etc/apt/sources.list.d/ 2>/dev/null || true)
|
||||||
|
|
||||||
|
if [[ -z "$enterprise_files" ]]; then
|
||||||
|
preflight_pass "No enterprise repositories enabled"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Enterprise repo found — test if subscription is valid
|
||||||
|
local http_code
|
||||||
|
http_code=$(curl -sS -o /dev/null -w "%{http_code}" -m 5 "https://enterprise.proxmox.com/debian/pve/dists/" 2>/dev/null) || http_code="000"
|
||||||
|
|
||||||
|
if [[ "$http_code" == "401" || "$http_code" == "403" ]]; then
|
||||||
|
preflight_warn "Enterprise repo enabled without valid subscription (HTTP ${http_code})"
|
||||||
|
echo -e " ${TAB}${INFO} apt-get update will show '401 Unauthorized' errors"
|
||||||
|
echo -e " ${TAB}${INFO} Disable in ${GN}/etc/apt/sources.list.d/${CL} or add a subscription key"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$http_code" =~ ^2[0-9]{2}$ ]]; then
|
||||||
|
preflight_pass "Enterprise repository accessible (subscription valid)"
|
||||||
|
else
|
||||||
|
preflight_warn "Enterprise repo check inconclusive (HTTP ${http_code})"
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
# preflight_cluster_quorum()
|
# preflight_cluster_quorum()
|
||||||
#
|
#
|
||||||
@@ -567,6 +604,9 @@ run_preflight() {
|
|||||||
preflight_network_bridge
|
preflight_network_bridge
|
||||||
preflight_dns_resolution
|
preflight_dns_resolution
|
||||||
|
|
||||||
|
# --- Repository checks ---
|
||||||
|
preflight_repo_access
|
||||||
|
|
||||||
# --- Proxmox/Cluster checks ---
|
# --- Proxmox/Cluster checks ---
|
||||||
preflight_cluster_quorum
|
preflight_cluster_quorum
|
||||||
preflight_lxc_stack
|
preflight_lxc_stack
|
||||||
|
|||||||
Reference in New Issue
Block a user