passthrough config copy fix

Providers did not implemet specific __deepcopy__ methods so for now use regular
copy for those.

Change-Id: I68a727a7b774d9c38f7d1cda633a85b9d096af92
This commit is contained in:
asarfaty 2020-06-15 10:26:59 +02:00 committed by Adit Sarfaty
parent 3ee4671388
commit 6f2c89c618
1 changed files with 7 additions and 0 deletions

View File

@ -45,6 +45,13 @@ class NsxPolicyLib(lib.NsxLibBase):
config = copy.deepcopy(self.nsxlib_config)
# X-Allow-Overwrite must be set for passthrough apis
config.allow_overwrite_header = True
# Manually copy providers (No deep copy, as those are instances)
# FIXME(asarfaty): This can be handled nicer by adding
# __deepcopy__ methods to the provider classes to do the deepcopy
# correctly
config.token_provider = self.nsxlib_config.token_provider
config.client_cert_provider = (
self.nsxlib_config.client_cert_provider)
self.nsx_api = v3.NsxLib(config)
else:
self.nsx_api = None