diff --git a/agents/proxmox_auto_enroll.sh b/agents/proxmox_auto_enroll.sh index ebfb20f..f999b90 100755 --- a/agents/proxmox_auto_enroll.sh +++ b/agents/proxmox_auto_enroll.sh @@ -33,6 +33,7 @@ HOST_PREFIX="${HOST_PREFIX:-}" SKIP_STOPPED="${SKIP_STOPPED:-true}" PARALLEL_INSTALL="${PARALLEL_INSTALL:-false}" MAX_PARALLEL="${MAX_PARALLEL:-5}" +FORCE_INSTALL="${FORCE_INSTALL:-false}" # ===== COLOR OUTPUT ===== RED='\033[0;31m' @@ -243,6 +244,13 @@ while IFS= read -r line; do # Install PatchMon agent in container info " Installing PatchMon agent..." + # Build install URL with force flag if enabled + install_url="$PATCHMON_URL/api/v1/hosts/install" + if [[ "$FORCE_INSTALL" == "true" ]]; then + install_url="$install_url?force=true" + info " Using force mode - will bypass broken packages" + fi + # Reset exit code for this container install_exit_code=0 @@ -253,7 +261,7 @@ while IFS= read -r line; do -H \"X-API-ID: $api_id\" \ -H \"X-API-KEY: $api_key\" \ -o patchmon-install.sh \ - '$PATCHMON_URL/api/v1/hosts/install' && \ + '$install_url' && \ bash patchmon-install.sh && \ rm -f patchmon-install.sh " 2>&1 { } } catch (_) {} - // Inject the token credentials, server URL, and curl flags into the script + // Check for --force parameter + const force_install = req.query.force === "true" || req.query.force === "1"; + + // Inject the token credentials, server URL, curl flags, and force flag into the script const env_vars = `#!/bin/bash # PatchMon Auto-Enrollment Configuration (Auto-generated) export PATCHMON_URL="${server_url}" export AUTO_ENROLLMENT_KEY="${token.token_key}" export AUTO_ENROLLMENT_SECRET="${token_secret}" export CURL_FLAGS="${curl_flags}" +export FORCE_INSTALL="${force_install ? "true" : "false"}" `; diff --git a/frontend/src/pages/HostDetail.jsx b/frontend/src/pages/HostDetail.jsx index 8d185ac..e2027b9 100644 --- a/frontend/src/pages/HostDetail.jsx +++ b/frontend/src/pages/HostDetail.jsx @@ -45,6 +45,7 @@ const HostDetail = () => { const [showDeleteModal, setShowDeleteModal] = useState(false); const [showAllUpdates, setShowAllUpdates] = useState(false); const [activeTab, setActiveTab] = useState("host"); + const [forceInstall, setForceInstall] = useState(false); const { data: host, @@ -1083,6 +1084,7 @@ const HostDetail = () => { const CredentialsModal = ({ host, isOpen, onClose }) => { const [showApiKey, setShowApiKey] = useState(false); const [activeTab, setActiveTab] = useState("quick-install"); + const [forceInstall, setForceInstall] = useState(false); const apiIdInputId = useId(); const apiKeyInputId = useId(); @@ -1104,6 +1106,12 @@ const CredentialsModal = ({ host, isOpen, onClose }) => { return settings?.ignore_ssl_self_signed ? "-sk" : "-s"; }; + // Helper function to build installation URL with optional force flag + const getInstallUrl = () => { + const baseUrl = `${serverUrl}/api/v1/hosts/install`; + return forceInstall ? `${baseUrl}?force=true` : baseUrl; + }; + const copyToClipboard = async (text) => { try { // Try modern clipboard API first @@ -1197,10 +1205,30 @@ const CredentialsModal = ({ host, isOpen, onClose }) => { Copy and run this command on the target host to securely install and configure the PatchMon agent:
+ + {/* Force Install Toggle */} ++ Enable this if the target host has broken packages + (CloudPanel, WHM, etc.) that block apt-get operations +
++ Enable this if your LXC containers have broken packages + (CloudPanel, WHM, etc.) that block apt-get operations +
+