Skip to content

VM-Core: Update some Functions#15113

Merged
michelroegl-brunner merged 1 commit into
mainfrom
MickLesk-patch-5
Jun 25, 2026
Merged

VM-Core: Update some Functions#15113
michelroegl-brunner merged 1 commit into
mainfrom
MickLesk-patch-5

Conversation

@MickLesk

@MickLesk MickLesk commented Jun 15, 2026

Copy link
Copy Markdown
Member

✍️ Description

see summarize here; #15113 (comment)

🔗 Related Issue

Fixes #

✅ Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to script metadata (PocketBase/website data).
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.

@github-actions github-actions Bot added the core label Jun 15, 2026
@MickLesk

Copy link
Copy Markdown
Member Author

@copilot im to lazy, summarize the changes as text

Copilot AI commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@copilot im to lazy, summarize the changes as text

Here’s a plain-text summary of what changed in the last commit:

  • Updated misc/vm-core.func only.
  • Added lazy-loading helpers for shared API/cloud-init functions and made source URLs configurable via COMMUNITY_SCRIPTS_URL.
  • Switched some hardcoded raw file links to GitHub raw URLs.
  • Improved error handling and cleanup flow (silent, error_handler, cleanup/spinner/temp-dir handling), with clearer failure output.
  • Standardized several failure exits to generic non-zero exits.
  • Expanded/refined Proxmox version validation logic (8.x and 9.0–9.2 checks).
  • Added a large set of VM setup helper functions (SSH check, network/bridge/model/MAC/VLAN/MTU prompts, start-vm prompt, storage selection/layout, disk reference creation).
  • Updated VM description HTML block generation (title handling and donation/link targets).

@MickLesk MickLesk marked this pull request as ready for review June 24, 2026 19:33
@MickLesk MickLesk requested a review from a team as a code owner June 24, 2026 19:33
Comment thread misc/vm-core.func
[[ -n "${_CORE_FUNC_LOADED:-}" ]] && return
_CORE_FUNC_LOADED=1

COMMUNITY_SCRIPTS_URL="${COMMUNITY_SCRIPTS_URL:-https://git.community-scripts.org/community-scripts/ProxmoxVE/raw/branch/main}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why headers from one source and general from our git?
Or is this just a fallback?

@CrazyWolf13 CrazyWolf13 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the shared VM helper library (misc/vm-core.func) to support newer VM creation flows (interactive prompts, storage selection, cloud-init helpers) and to adjust supporting utilities (loading shared functions, curl/error handling, cleanup, and VM description markup). This file is a core dependency for VM scripts (e.g., vm/docker-vm.sh) and affects script startup/validation and error semantics.

Changes:

  • Added lazy-loading helpers for API and cloud-init functions, plus many new VM interactive prompt/helpers (VMID, machine type, disk, CPU/RAM, networking, storage selection, disk references).
  • Modified error/curl utilities (silent, curl_handler, __curl_err_handler) and cleanup behavior (spinner stop, temp dir removal).
  • Updated various URLs and the VM description HTML block.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread misc/vm-core.func
Comment on lines +19 to +23
load_api_functions() {
if ! declare -f post_to_api_vm >/dev/null 2>&1; then
source /dev/stdin <<<$(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/api.func")
fi
}
Comment thread misc/vm-core.func
Comment on lines +207 to +210
# Source explain_exit_code if needed
if ! declare -f explain_exit_code >/dev/null 2>&1; then
source <(curl -fsSL "$COMMUNITY_SCRIPTS_URL/misc/error_handler.func") 2>/dev/null || true
fi
Comment thread misc/vm-core.func
Comment on lines 203 to 205
set -Eeuo pipefail
trap 'error_handler' ERR

Comment thread misc/vm-core.func
Comment on lines 334 to 336
[[ -n "$curl_msg" ]] && printf "%s\n" "$curl_msg" >&2
exit "$exit_code"
exit 1
}
Comment thread misc/vm-core.func
Comment on lines 345 to 351
if [[ "$(ps -p $$ -o comm=)" != "bash" ]]; then
clear
msg_error "Your default shell is currently not set to Bash. To use these scripts, please switch to the Bash shell."
echo -e "\nExiting..."
sleep 2
exit 103
exit
fi
Comment thread misc/vm-core.func
Comment on lines +1049 to +1052
if [ -z "$valid_storage" ]; then
msg_error "Unable to detect a valid storage location."
exit
elif [ $((${#storage_menu[@]} / 3)) -eq 1 ]; then
Comment thread misc/vm-core.func
Comment on lines 261 to 264
if [[ -z "$url" ]]; then
msg_error "no valid url or option entered for curl_handler"
exit 64
exit 1
fi
Comment thread misc/vm-core.func
Comment on lines 288 to 293
curl_stderr=$(</tmp/curl_error.log)
rm -f /tmp/curl_error.log
fi
__curl_err_handler "$exit_code" "$url" "$curl_stderr"
exit "$exit_code"
exit 1 # hard exit if exit_code is not 0
fi
Comment thread misc/vm-core.func
Comment on lines 1106 to 1110
<p style='margin: 16px 0;'>
<a href='${donate_url}' target='_blank' rel='noopener noreferrer'>
<img src='https://img.shields.io/badge/❤️-Sponsoring%20%26%20Donations-FF5E5B' alt='Sponsoring and donations' />
</a>
</p>

<p style='margin: 12px 0;'>
<a href='${script_url}' target='_blank' rel='noopener noreferrer'>
<img src='https://img.shields.io/badge/📦-Open%20Script%20Page-00617f' alt='Open script page' />
<a href='https://ko-fi.com/community_scripts' target='_blank' rel='noopener noreferrer'>
<img src='https://img.shields.io/badge/&#x2615;-Buy us a coffee-blue' alt='spend Coffee' />
</a>
</p>
Comment thread misc/vm-core.func
Comment on lines +781 to +784
else
echo -e "${DISKSIZE}${BOLD}${RD}Invalid Disk Size. Please use a number (e.g., 10 or 10G).${CL}"
exit_script
fi
@michelroegl-brunner michelroegl-brunner merged commit edf1670 into main Jun 25, 2026
10 checks passed
@github-actions github-actions Bot deleted the MickLesk-patch-5 branch June 26, 2026 03:03
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants