From 989e777ab450617f0526f2ba9caa0d305f5cb97b Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Tue, 23 Jan 2018 02:16:06 -0800 Subject: [PATCH] Ensure that max_attempts is set The NsxLibApiBase can have the nsxlib_config passed as None. In order to use the retry logic we retrieve the max_attempts from the client object. This is always set. Change-Id: I4ac60f9a3d89b60d9b35390825578cb7f849dfa8 --- vmware_nsxlib/v3/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vmware_nsxlib/v3/utils.py b/vmware_nsxlib/v3/utils.py index ebb69ad0..3c41a2d9 100644 --- a/vmware_nsxlib/v3/utils.py +++ b/vmware_nsxlib/v3/utils.py @@ -386,7 +386,7 @@ class NsxLibApiBase(object): # it again with the new revision_id @retry_upon_exception( nsxlib_exceptions.StaleRevision, - max_attempts=self.nsxlib_config.max_attempts) + max_attempts=self.client.max_attempts) def do_update(): return self._internal_update_resource( resource, payload, @@ -410,7 +410,7 @@ class NsxLibApiBase(object): # Using internal method so we can access max_attempts in the decorator @retry_upon_exception( nsxlib_exceptions.StaleRevision, - max_attempts=self.nsxlib_config.max_attempts) + max_attempts=self.client.max_attempts) def _do_delete(): self.client.delete(self.get_path(resource)) @@ -420,7 +420,7 @@ class NsxLibApiBase(object): # Using internal method so we can access max_attempts in the decorator @retry_upon_exception( nsxlib_exceptions.StaleRevision, - max_attempts=self.nsxlib_config.max_attempts) + max_attempts=self.client.max_attempts) def _do_create(): return self.client.create(resource, body, headers=headers)