[PR #2785] Feature Template Path for Mountings #3885

Closed
opened 2025-11-20 06:07:13 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/community-scripts/ProxmoxVE/pull/2785

State: closed
Merged: Yes


✍️ Description

This PR fixes an issue where the script incorrectly assumes that LXC templates are always stored in /var/lib/vz/template/cache/, even when using a non-local storage (e.g., a NAS share).

Issue:

  • The script retrieves the selected storage via select_storage template, but it still hardcodes the template path as:
    TEMPLATE_PATH="/var/lib/vz/template/cache/$TEMPLATE"
    
  • This causes errors when using a remote storage, as the template is not found in the expected location.
  • As a result, the script falsely detects the template as missing or corrupted and attempts to redownload it, even when it exists on the specified storage.

Fix:

  • The template path is now dynamically retrieved using:
    TEMPLATE_PATH="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE)"
    
  • This ensures that the correct storage path is used, regardless of whether the template is stored locally or on a remote share.
  • Additionally, a validation check was added to prevent the script from proceeding if the resolved path is invalid.

Testing:

  • Tested with both local (local) and remote (nas-share) storage configurations.
  • Verified that the script correctly detects and uses the existing template without unnecessary redownloads.

This change improves compatibility with non-local storage setups and prevents unnecessary downloads.

Link: #2781

Prerequisites

Before this PR can be reviewed, the following must be completed:

  • Self-review performed – Code follows established patterns and conventions.
  • Testing performed – Changes have been thoroughly tested and verified.

🛠️ Type of Change

Select all that apply:

  • [] 🆕 New script – A fully functional and tested script or script set.
  • [] 🐞 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.
**Original Pull Request:** https://github.com/community-scripts/ProxmoxVE/pull/2785 **State:** closed **Merged:** Yes --- ## ✍️ Description This PR fixes an issue where the script incorrectly assumes that LXC templates are always stored in `/var/lib/vz/template/cache/`, even when using a non-local storage (e.g., a NAS share). ### **Issue:** - The script retrieves the selected storage via `select_storage template`, but it still hardcodes the template path as: ```sh TEMPLATE_PATH="/var/lib/vz/template/cache/$TEMPLATE" ``` - This causes errors when using a remote storage, as the template is not found in the expected location. - As a result, the script falsely detects the template as missing or corrupted and attempts to redownload it, even when it exists on the specified storage. ### **Fix:** - The template path is now dynamically retrieved using: ```sh TEMPLATE_PATH="$(pvesm path $TEMPLATE_STORAGE:vztmpl/$TEMPLATE)" ``` - This ensures that the correct storage path is used, regardless of whether the template is stored locally or on a remote share. - Additionally, a validation check was added to prevent the script from proceeding if the resolved path is invalid. ### **Testing:** - Tested with both local (`local`) and remote (`nas-share`) storage configurations. - Verified that the script correctly detects and uses the existing template without unnecessary redownloads. This change improves compatibility with non-local storage setups and prevents unnecessary downloads. ## 🔗 Related PR / Discussion / Issue Link: #2781 ## ✅ Prerequisites Before this PR can be reviewed, the following must be completed: - [x] **Self-review performed** – Code follows established patterns and conventions. - [x] **Testing performed** – Changes have been thoroughly tested and verified. ## 🛠️ Type of Change Select all that apply: - [] 🆕 **New script** – A fully functional and tested script or script set. - [] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [x] ✨ **New feature** – Adds new, non-breaking functionality. - [] 💥 **Breaking change** – Alters existing functionality in a way that may require updates.
saavagebueno added the pull-request label 2025-11-20 06:07:13 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#3885