From bacb8f58e11bca01cee27e7621355f5838ec4efc Mon Sep 17 00:00:00 2001 From: Ali Mirjamali Date: Thu, 10 Oct 2024 03:48:08 +0330 Subject: [PATCH] Exclude VMs with `skip-update` boolean feature fixes: https://github.com/QubesOS/qubes-issues/issues/9029 --- doc/tools/qubes-vm-update.rst | 2 ++ vmupdate/vmupdate.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/doc/tools/qubes-vm-update.rst b/doc/tools/qubes-vm-update.rst index 100af55..27a3636 100644 --- a/doc/tools/qubes-vm-update.rst +++ b/doc/tools/qubes-vm-update.rst @@ -85,6 +85,8 @@ Targeting is used to choose the VMs that will be checked for available updates, Additionally, not all VMs in the system can be updated directly (such as AppVMs), and to update them, you must use one of the "propagation" options. This means, after updating the template, restarting the VM and applying the installed updates to it. Using at least the `--apply-to-sys` flag is recommended, which restarts all service VMs. Keep in mind that during this process, unsaved data may be lost. +VMs with `skip-update` feature set to True will be excluded from update, unless directly targeted with `--targets` option. + RETURN CODES ============ diff --git a/vmupdate/vmupdate.py b/vmupdate/vmupdate.py index 49d5edc..f45b0e0 100644 --- a/vmupdate/vmupdate.py +++ b/vmupdate/vmupdate.py @@ -208,6 +208,12 @@ def preselect_targets(args, app) -> Set[qubesadmin.vm.QubesVM]: print("Skipping dom0. To update AdminVM use `qubes-dom0-update`") targets = {vm for vm in targets if vm.name != 'dom0' and vm.name not in to_skip} + + # exclude vms with `skip-update` feature, but allow --targets to override it + if not args.targets: + targets = {vm for vm in targets + if not bool(vm.features.get('skip-update', False))} + return targets