storage: fix getting list of pool driver parameters

function.func_code existed in python2. Use inspect module (instead of
__code__ attribute).
This commit is contained in:
Marek Marczykowski-Górecki 2017-08-12 22:42:30 +02:00
parent 3338854b1c
commit 9ad85a3dff
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -822,8 +822,9 @@ def driver_parameters(name):
''' Get __init__ parameters from a driver with out `self` & `name`. '''
init_function = qubes.utils.get_entry_point_one(
qubes.storage.STORAGE_ENTRY_POINT, name).__init__
params = init_function.func_code.co_varnames
ignored_params = ['self', 'name']
signature = inspect.signature(init_function)
params = signature.parameters.keys()
ignored_params = ['self', 'name', 'kwargs']
return [p for p in params if p not in ignored_params]