vm/qubesvm: convert firewall_conf into dumb, read-only property

Don't allow anything else than firewall.xml.
This commit is contained in:
Marek Marczykowski-Górecki 2017-03-12 01:50:09 +01:00
parent 123feced36
commit 2d2672ec58
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 4 additions and 16 deletions

View File

@ -340,20 +340,6 @@ class TC_90_QubesVM(QubesVMTestsMixin,qubes.tests.QubesTestCase):
vm = self.get_vm() vm = self.get_vm()
self._test_generic_bool_property(vm, 'include_in_backups', True) self._test_generic_bool_property(vm, 'include_in_backups', True)
def test_240_firewall_conf(self):
vm = self.get_vm()
self.assertPropertyDefaultValue(vm, 'firewall_conf', 'firewall.xml')
self.assertPropertyValue(vm, 'firewall_conf', 'other.xml',
'other.xml', 'other.xml')
del vm.firewall_conf
self.assertPropertyDefaultValue(vm, 'firewall_conf',
'firewall.xml')
@unittest.expectedFailure
def test_241_firewall_conf_invalid(self):
vm = self.get_vm()
self.assertPropertyInvalidValue(vm, 'firewall_conf', None)
@qubes.tests.skipUnlessDom0 @qubes.tests.skipUnlessDom0
def test_250_kernel(self): def test_250_kernel(self):
kernels = os.listdir(os.path.join( kernels = os.listdir(os.path.join(

View File

@ -91,8 +91,10 @@ class NetVMMixin(qubes.events.Emitter):
doc='''If this domain can act as network provider (formerly known as doc='''If this domain can act as network provider (formerly known as
NetVM or ProxyVM)''') NetVM or ProxyVM)''')
firewall_conf = qubes.property('firewall_conf', type=str,
default='firewall.xml') @property
def firewall_conf(self):
return 'firewall.xml'
# #
# used in networked appvms or proxyvms (netvm is not None) # used in networked appvms or proxyvms (netvm is not None)