diff --git a/qubes/__init__.py b/qubes/__init__.py index 697605ce..cd0c34bf 100644 --- a/qubes/__init__.py +++ b/qubes/__init__.py @@ -193,7 +193,7 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name self._setter = setter self._saver = saver if saver is not None else ( lambda self, prop, value: str(value)) - self._type = type + self.type = type self._default = default self._write_once = write_once self.order = order @@ -245,8 +245,8 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name if self._setter is not None: value = self._setter(instance, self, value) - if self._type not in (None, type(value)): - value = self._type(value) + if self.type not in (None, type(value)): + value = self.type(value) if has_oldvalue: instance.fire_event_pre('property-pre-set:' + self.__name__, diff --git a/qubes/mgmt.py b/qubes/mgmt.py index a6f345a6..76cf04b4 100644 --- a/qubes/mgmt.py +++ b/qubes/mgmt.py @@ -165,14 +165,28 @@ class QubesMgmt(object): self.fire_event_for_permission() + property_def = self.dest.property_get_def(self.arg) + # explicit list to be sure that it matches protocol spec + if isinstance(property_def, qubes.vm.VMProperty): + property_type = 'vm' + elif property_def.type is int: + property_type = 'int' + elif property_def.type is bool: + property_type = 'bool' + elif self.arg == 'label': + property_type = 'label' + else: + property_type = 'str' + try: value = getattr(self.dest, self.arg) except AttributeError: - return 'default=True ' + return 'default=True type={} '.format(property_type) else: - return 'default={} {}'.format( + return 'default={} type={} {}'.format( str(self.dest.property_is_default(self.arg)), - self.repr(value)) + property_type, + str(value) if value is not None else '') @asyncio.coroutine def vm_property_help(self, untrusted_payload):