Переглянути джерело

ext/block: accept any boolean value for 'read-only' option

Be consistent with other parts of the Admin API. Especially ...Attach
accept "standard" boolean values for persistent= option.
Marek Marczykowski-Górecki 6 роки тому
батько
коміт
451cc339c7
1 змінених файлів з 2 додано та 4 видалено
  1. 2 4
      qubes/ext/block.py

+ 2 - 4
qubes/ext/block.py

@@ -243,10 +243,8 @@ class BlockDeviceExtension(qubes.ext.Extension):
                     raise qubes.exc.QubesValueError(
                         'Invalid frontend-dev option value: ' + value)
             elif option == 'read-only':
-                if value not in ('yes', 'no'):
-                    raise qubes.exc.QubesValueError(
-                        'read-only option can only have '
-                        '\'yes\' or \'no\' value')
+                options[option] = (
+                    'yes' if qubes.property.bool(None, None, value) else 'no')
             elif option == 'devtype':
                 if value not in ('disk', 'cdrom'):
                     raise qubes.exc.QubesValueError(