Assign the platform after declaration
This simple patch changes when the arch value is assigned in the connector factory until after the function defintion. kwarg values assigned in function declarations are assigned at file import time and not at call time. Change-Id: I08b6560a5f4dfd221c4211ab35a784c4605150dc
This commit is contained in:
parent
28f3d0950f
commit
49c2bdf641
|
@ -120,9 +120,15 @@ class InitiatorConnector(executor.Executor):
|
|||
def factory(protocol, root_helper, driver=None,
|
||||
execute=putils.execute, use_multipath=False,
|
||||
device_scan_attempts=DEVICE_SCAN_ATTEMPTS_DEFAULT,
|
||||
arch=platform.machine(),
|
||||
arch=None,
|
||||
*args, **kwargs):
|
||||
"""Build a Connector object based upon protocol and architecture."""
|
||||
|
||||
# We do this instead of assigning it in the definition
|
||||
# to help mocking for unit tests
|
||||
if arch is None:
|
||||
arch = platform.machine()
|
||||
|
||||
LOG.debug("Factory for %(protocol)s on %(arch)s",
|
||||
{'protocol': protocol, 'arch': arch})
|
||||
protocol = protocol.upper()
|
||||
|
|
Loading…
Reference in New Issue