Allow include=None to be passed to admin.backup.Info

This is forwarded to qubes.backup.Backup(), which uses None to choose
VMs according to their include_in_backups property.

('git show -w' recommended)
This commit is contained in:
Rusty Bird 2018-02-22 20:50:23 +00:00
parent dbaf60ca24
commit 59abdeb30e
No known key found for this signature in database
GPG Key ID: 469D78F47AAF2ADF

View File

@ -1293,8 +1293,9 @@ class QubesAdminAPI(qubes.api.AbstractQubesAPI):
dest_vm = profile_data['destination_vm'] dest_vm = profile_data['destination_vm']
dest_path = profile_data['destination_path'] dest_path = profile_data['destination_path']
include_vms = profile_data['include'] include_vms = profile_data['include']
# convert old keywords to new keywords if include_vms is not None:
include_vms = [vm.replace('$', '@') for vm in include_vms] # convert old keywords to new keywords
include_vms = [vm.replace('$', '@') for vm in include_vms]
exclude_vms = profile_data.get('exclude', []) exclude_vms = profile_data.get('exclude', [])
# convert old keywords to new keywords # convert old keywords to new keywords
exclude_vms = [vm.replace('$', '@') for vm in exclude_vms] exclude_vms = [vm.replace('$', '@') for vm in exclude_vms]
@ -1339,14 +1340,17 @@ class QubesAdminAPI(qubes.api.AbstractQubesAPI):
'specify passphrase_text or passphrase_vm') 'specify passphrase_text or passphrase_vm')
# handle include # handle include
vms_to_backup = set(vm for vm in self.app.domains if include_vms is None:
if any(qubes.utils.match_vm_name_with_special(vm, name) vms_to_backup = None
for name in include_vms)) else:
vms_to_backup = set(vm for vm in self.app.domains
if any(qubes.utils.match_vm_name_with_special(vm, name)
for name in include_vms))
# handle exclude # handle exclude
vms_to_backup.difference_update(vm for vm in self.app.domains vms_to_backup.difference_update(vm for vm in self.app.domains
if any(qubes.utils.match_vm_name_with_special(vm, name) if any(qubes.utils.match_vm_name_with_special(vm, name)
for name in exclude_vms)) for name in exclude_vms))
kwargs = { kwargs = {
'target_vm': dest_vm, 'target_vm': dest_vm,