From b5012c4225622074c910b4edfa509004fb915fa9 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 19 Jun 2025 18:50:23 +0200 Subject: [PATCH] Feat: Quorum Status (#5278) --- .github/CONTRIBUTOR_AND_GUIDES/CODE-AUDIT.md | 4 +- .github/autolabeler-config.json | 61 +++++++++++++++----- .github/workflows/validate-filenames.yml | 4 +- misc/build.func | 2 +- {ct => misc}/create_lxc.sh | 11 ++++ 5 files changed, 64 insertions(+), 18 deletions(-) rename {ct => misc}/create_lxc.sh (95%) diff --git a/.github/CONTRIBUTOR_AND_GUIDES/CODE-AUDIT.md b/.github/CONTRIBUTOR_AND_GUIDES/CODE-AUDIT.md index 158a5c6ce..17a1ff4a4 100644 --- a/.github/CONTRIBUTOR_AND_GUIDES/CODE-AUDIT.md +++ b/.github/CONTRIBUTOR_AND_GUIDES/CODE-AUDIT.md @@ -5,10 +5,10 @@ 1) [adguard.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/ct/adguard.sh): This script collects system parameters. (Also holds the function to update the application.) 2) [build.func](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/build.func): Adds user settings and integrates collected information. -3) [create_lxc.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/ct/create_lxc.sh): Constructs the LXC container. +3) [create_lxc.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/create_lxc.sh): Constructs the LXC container. 4) [adguard-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/install/adguard-install.sh): Executes functions from [install.func](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/install.func), and installs the application. 5) [adguard.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/ct/adguard.sh) (again): To display the completion message. -The installation process uses reusable scripts: [build.func](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/build.func), [create_lxc.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/ct/create_lxc.sh), and [install.func](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/install.func), which are not specific to any particular application. +The installation process uses reusable scripts: [build.func](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/build.func), [create_lxc.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/create_lxc.sh), and [install.func](https://github.com/community-scripts/ProxmoxVE/blob/main/misc/install.func), which are not specific to any particular application. To gain a better understanding, focus on reviewing [adguard-install.sh](https://github.com/community-scripts/ProxmoxVE/blob/main/install/adguard-install.sh). This script contains the commands and configurations for installing and configuring AdGuard Home within the LXC container. diff --git a/.github/autolabeler-config.json b/.github/autolabeler-config.json index 068d559fb..ad9ce69e5 100644 --- a/.github/autolabeler-config.json +++ b/.github/autolabeler-config.json @@ -2,21 +2,43 @@ "new script": [ { "fileStatus": "added", - "includeGlobs": ["ct/**", "install/**", "misc/**", "turnkey/**", "vm/**"], + "includeGlobs": [ + "ct/**", + "install/**", + "misc/**", + "turnkey/**", + "vm/**" + ], "excludeGlobs": [] } ], "update script": [ { "fileStatus": "modified", - "includeGlobs": ["ct/**", "install/**", "misc/**", "turnkey/**", "vm/**"], - "excludeGlobs": ["misc/build.func", "misc/install.func", "misc/api.func"] + "includeGlobs": [ + "ct/**", + "install/**", + "misc/**", + "turnkey/**", + "vm/**" + ], + "excludeGlobs": [ + "misc/build.func", + "misc/install.func", + "misc/api.func" + ] } ], "delete script": [ { "fileStatus": "removed", - "includeGlobs": ["ct/**", "install/**", "misc/**", "turnkey/**", "vm/**"], + "includeGlobs": [ + "ct/**", + "install/**", + "misc/**", + "turnkey/**", + "vm/**" + ], "excludeGlobs": [] } ], @@ -27,7 +49,7 @@ "*.md", ".github/**", "misc/*.func", - "ct/create_lxc.sh", + "misc/create_lxc.sh", "api/**" ], "excludeGlobs": [] @@ -36,46 +58,57 @@ "core": [ { "fileStatus": null, - "includeGlobs": ["misc/*.func", "ct/create_lxc.sh"], + "includeGlobs": [ + "misc/*.func", + "misc/create_lxc.sh" + ], "excludeGlobs": [] } ], "website": [ { "fileStatus": null, - "includeGlobs": ["frontend/**"], + "includeGlobs": [ + "frontend/**" + ], "excludeGlobs": [] } ], "api": [ { "fileStatus": null, - "includeGlobs": ["api/**", "misc/api.func"], + "includeGlobs": [ + "api/**", + "misc/api.func" + ], "excludeGlobs": [] } ], "github": [ { "fileStatus": null, - "includeGlobs": [".github/**"], + "includeGlobs": [ + ".github/**" + ], "excludeGlobs": [] } ], "json": [ { "fileStatus": "modified", - "includeGlobs": ["frontend/public/json/**"], + "includeGlobs": [ + "frontend/public/json/**" + ], "excludeGlobs": [] } ], - "high risk": [ { "fileStatus": null, "includeGlobs": [ "misc/build.func", "misc/install.func", - "ct/create_lxc.sh" + "misc/create_lxc.sh" ], "excludeGlobs": [] } @@ -83,7 +116,9 @@ "documentation": [ { "fileStatus": null, - "includeGlobs": ["*.md"], + "includeGlobs": [ + "*.md" + ], "excludeGlobs": [] } ] diff --git a/.github/workflows/validate-filenames.yml b/.github/workflows/validate-filenames.yml index 1c2ae38b1..d881be586 100644 --- a/.github/workflows/validate-filenames.yml +++ b/.github/workflows/validate-filenames.yml @@ -51,8 +51,8 @@ jobs: NON_COMPLIANT_FILES="" for FILE in $CHANGED_FILES; do - # Datei "ct/create_lxc.sh" explizit überspringen - if [[ "$FILE" == "ct/create_lxc.sh" ]]; then + # Skip File "misc/create_lxc.sh" + if [[ "$FILE" == "misc/create_lxc.sh" ]]; then continue fi BASENAME=$(echo "$(basename "${FILE%.*}")") diff --git a/misc/build.func b/misc/build.func index 2e053ff7f..57d325182 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1143,7 +1143,7 @@ build_container() { $PW " # This executes create_lxc.sh and creates the container and .conf file - bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/ct/create_lxc.sh)" $? + bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/create_lxc.sh)" $? LXC_CONFIG=/etc/pve/lxc/${CTID}.conf if [ "$CT_TYPE" == "0" ]; then diff --git a/ct/create_lxc.sh b/misc/create_lxc.sh similarity index 95% rename from ct/create_lxc.sh rename to misc/create_lxc.sh index 7d0779919..17ee1e516 100644 --- a/ct/create_lxc.sh +++ b/misc/create_lxc.sh @@ -207,6 +207,17 @@ msg_ok "Using ${BL}$TEMPLATE_STORAGE${CL} ${GN}for Template Storage." CONTAINER_STORAGE=$(select_storage container) msg_ok "Using ${BL}$CONTAINER_STORAGE${CL} ${GN}for Container Storage." +# Check Cluster Quorum if in Cluster +if [ -f /etc/pve/corosync.conf ]; then + msg_info "Checking Proxmox cluster quorum status" + if ! pvecm status | awk -F':' '/^Quorate/ { exit ($2 ~ /Yes/) ? 0 : 1 }'; then + printf "\e[?25h" + msg_error "Cluster is not quorate. Start all nodes or configure quorum device (QDevice)." + exit 210 + fi + msg_ok "Cluster is quorate" +fi + # Update LXC template list msg_info "Updating LXC Template List" #check_network