Fix setting VM property to None
None value should be encoded as empty string.
This commit is contained in:
parent
1aab64d5b0
commit
c988ef41a3
@ -211,6 +211,8 @@ class PropertyHolder(object):
|
|||||||
else:
|
else:
|
||||||
if isinstance(value, qubesadmin.vm.QubesVM):
|
if isinstance(value, qubesadmin.vm.QubesVM):
|
||||||
value = value.name
|
value = value.name
|
||||||
|
if value is None:
|
||||||
|
value = ''
|
||||||
try:
|
try:
|
||||||
self.qubesd_call(
|
self.qubesd_call(
|
||||||
self._method_dest,
|
self._method_dest,
|
||||||
|
@ -145,7 +145,7 @@ class TC_00_Properties(qubesadmin.tests.vm.VMTestCase):
|
|||||||
|
|
||||||
def test_024_set_none(self):
|
def test_024_set_none(self):
|
||||||
self.app.expected_calls[
|
self.app.expected_calls[
|
||||||
('test-vm', 'admin.vm.property.Set', 'prop1', b'None')] = \
|
('test-vm', 'admin.vm.property.Set', 'prop1', b'')] = \
|
||||||
b'0\x00'
|
b'0\x00'
|
||||||
self.vm.prop1 = None
|
self.vm.prop1 = None
|
||||||
self.assertAllCalled()
|
self.assertAllCalled()
|
||||||
|
Loading…
Reference in New Issue
Block a user