From bb7835c35044eb0082184bc77058a6460dfd0f61 Mon Sep 17 00:00:00 2001 From: Jose Date: Sat, 7 Feb 2026 09:24:46 +0100 Subject: [PATCH] =?UTF-8?q?refactor=20=E2=99=BB=EF=B8=8F:=20Refactor=20sub?= =?UTF-8?q?scription=20task=20to=20check=20and=20remove=20nag=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This refactoring ensures that the subscription task properly checks for and removes nag messages in both legacy and minified JavaScript files, enhancing robustness by handling cases where files may not exist. ✅ No silent failures ✅ Safe if file doesn’t exist ❌ Hard fail if Proxmox changes the JS logic and the patch no longer applies ✅ Clear signal that the role needs updating after a major upgrade --- tasks/subscription.yml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tasks/subscription.yml b/tasks/subscription.yml index 710da0f..b098b89 100644 --- a/tasks/subscription.yml +++ b/tasks/subscription.yml @@ -1,16 +1,34 @@ --- +- name: subscription | Check for legacy proxmoxlib.js + stat: + path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js + register: proxmoxlib_js + - name: subscription | Remove subscription nag (legacy proxmoxlib.js) ansible.builtin.replace: path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js regexp: "if \\(data.status !== 'Active'\\)" replace: "if (false)" - ignore_errors: true + when: proxmoxlib_js.stat.exists + register: patch_legacy + failed_when: + - proxmoxlib_js.stat.exists + - patch_legacy.matched == 0 notify: restart pveproxy +- name: subscription | Check for minified proxmoxlib.min.js (VE 8/9) + stat: + path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js + register: proxmoxlib_min_js + - name: subscription | Remove subscription nag (minified bundle for VE 8/9) ansible.builtin.replace: path: /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.min.js regexp: "data.status!=='Active'" replace: "false" - ignore_errors: true + when: proxmoxlib_min_js.stat.exists + register: patch_minified + failed_when: + - proxmoxlib_min_js.stat.exists + - patch_minified.matched == 0 notify: restart pveproxy