qvm-backup: let backup core handle default VM selection
This takes the include_in_backups property into account, and does not omit dom0.
This commit is contained in:
parent
2d8bade8b2
commit
78571898da
@ -33,10 +33,7 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase):
|
|||||||
profile = io.StringIO()
|
profile = io.StringIO()
|
||||||
qvm_backup.write_backup_profile(profile, args)
|
qvm_backup.write_backup_profile(profile, args)
|
||||||
expected_profile = (
|
expected_profile = (
|
||||||
'destination_path: /var/tmp\n'
|
'{destination_path: /var/tmp, destination_vm: dom0, include: null}\n'
|
||||||
'destination_vm: dom0\n'
|
|
||||||
'include: [\'$type:AppVM\', \'$type:TemplateVM\', '
|
|
||||||
'\'$type:StandaloneVM\']\n'
|
|
||||||
)
|
)
|
||||||
self.assertEqual(profile.getvalue(), expected_profile)
|
self.assertEqual(profile.getvalue(), expected_profile)
|
||||||
|
|
||||||
@ -67,8 +64,7 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase):
|
|||||||
'destination_path: /var/tmp\n'
|
'destination_path: /var/tmp\n'
|
||||||
'destination_vm: dom0\n'
|
'destination_vm: dom0\n'
|
||||||
'exclude: [vm1, vm2]\n'
|
'exclude: [vm1, vm2]\n'
|
||||||
'include: [\'$type:AppVM\', \'$type:TemplateVM\', '
|
'include: null\n'
|
||||||
'\'$type:StandaloneVM\']\n'
|
|
||||||
)
|
)
|
||||||
self.assertEqual(profile.getvalue(), expected_profile)
|
self.assertEqual(profile.getvalue(), expected_profile)
|
||||||
|
|
||||||
@ -77,11 +73,7 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase):
|
|||||||
profile = io.StringIO()
|
profile = io.StringIO()
|
||||||
qvm_backup.write_backup_profile(profile, args, passphrase='test123')
|
qvm_backup.write_backup_profile(profile, args, passphrase='test123')
|
||||||
expected_profile = (
|
expected_profile = (
|
||||||
'destination_path: /var/tmp\n'
|
'{destination_path: /var/tmp, destination_vm: dom0, include: null, passphrase_text: test123}\n'
|
||||||
'destination_vm: dom0\n'
|
|
||||||
'include: [\'$type:AppVM\', \'$type:TemplateVM\', '
|
|
||||||
'\'$type:StandaloneVM\']\n'
|
|
||||||
'passphrase_text: test123\n'
|
|
||||||
)
|
)
|
||||||
self.assertEqual(profile.getvalue(), expected_profile)
|
self.assertEqual(profile.getvalue(), expected_profile)
|
||||||
|
|
||||||
@ -101,10 +93,7 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase):
|
|||||||
qvm_backup.main(['--save-profile', 'test-profile', '/var/tmp'],
|
qvm_backup.main(['--save-profile', 'test-profile', '/var/tmp'],
|
||||||
app=self.app)
|
app=self.app)
|
||||||
expected_profile = (
|
expected_profile = (
|
||||||
'destination_path: /var/tmp\n'
|
'{destination_path: /var/tmp, destination_vm: dom0, include: null}\n'
|
||||||
'destination_vm: dom0\n'
|
|
||||||
'include: [\'$type:AppVM\', \'$type:TemplateVM\', '
|
|
||||||
'\'$type:StandaloneVM\']\n'
|
|
||||||
)
|
)
|
||||||
with open(profile_path) as f:
|
with open(profile_path) as f:
|
||||||
self.assertEqual(expected_profile, f.read())
|
self.assertEqual(expected_profile, f.read())
|
||||||
@ -130,11 +119,8 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase):
|
|||||||
qvm_backup.main(['--save-profile', 'test-profile', '/var/tmp'],
|
qvm_backup.main(['--save-profile', 'test-profile', '/var/tmp'],
|
||||||
app=self.app)
|
app=self.app)
|
||||||
expected_profile = (
|
expected_profile = (
|
||||||
'destination_path: /var/tmp\n'
|
'{destination_path: /var/tmp, destination_vm: dom0, include: null, passphrase_text: some\n'
|
||||||
'destination_vm: dom0\n'
|
' password}\n'
|
||||||
'include: [\'$type:AppVM\', \'$type:TemplateVM\', '
|
|
||||||
'\'$type:StandaloneVM\']\n'
|
|
||||||
'passphrase_text: some password\n'
|
|
||||||
)
|
)
|
||||||
with open(profile_path) as f:
|
with open(profile_path) as f:
|
||||||
self.assertEqual(expected_profile, f.read())
|
self.assertEqual(expected_profile, f.read())
|
||||||
@ -194,8 +180,7 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase):
|
|||||||
'destination_path: /var/tmp\n'
|
'destination_path: /var/tmp\n'
|
||||||
'destination_vm: dom0\n'
|
'destination_vm: dom0\n'
|
||||||
'exclude: [vm1]\n'
|
'exclude: [vm1]\n'
|
||||||
'include: [\'$type:AppVM\', \'$type:TemplateVM\', '
|
'include: null\n'
|
||||||
'\'$type:StandaloneVM\']\n'
|
|
||||||
'# specify backup passphrase below\n'
|
'# specify backup passphrase below\n'
|
||||||
'passphrase_text: ...\n'
|
'passphrase_text: ...\n'
|
||||||
)
|
)
|
||||||
@ -225,11 +210,8 @@ class TC_00_qvm_backup(qubesadmin.tests.QubesTestCase):
|
|||||||
'test-profile', '/var/tmp'],
|
'test-profile', '/var/tmp'],
|
||||||
app=self.app)
|
app=self.app)
|
||||||
expected_profile = (
|
expected_profile = (
|
||||||
'destination_path: /var/tmp\n'
|
'{destination_path: /var/tmp, destination_vm: dom0, include: null, passphrase_text: other\n'
|
||||||
'destination_vm: dom0\n'
|
' passphrase}\n'
|
||||||
'include: [\'$type:AppVM\', \'$type:TemplateVM\', '
|
|
||||||
'\'$type:StandaloneVM\']\n'
|
|
||||||
'passphrase_text: other passphrase\n'
|
|
||||||
)
|
)
|
||||||
with open(profile_path) as f:
|
with open(profile_path) as f:
|
||||||
self.assertEqual(expected_profile, f.read())
|
self.assertEqual(expected_profile, f.read())
|
||||||
|
@ -94,11 +94,7 @@ def write_backup_profile(output_stream, args, passphrase=None):
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
profile_data = {}
|
profile_data = {}
|
||||||
if args.vms:
|
profile_data['include'] = args.vms or None
|
||||||
profile_data['include'] = args.vms
|
|
||||||
else:
|
|
||||||
profile_data['include'] = [
|
|
||||||
'$type:AppVM', '$type:TemplateVM', '$type:StandaloneVM']
|
|
||||||
if args.exclude_list:
|
if args.exclude_list:
|
||||||
profile_data['exclude'] = args.exclude_list
|
profile_data['exclude'] = args.exclude_list
|
||||||
if passphrase:
|
if passphrase:
|
||||||
|
Loading…
Reference in New Issue
Block a user