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
This commit is contained in:
Gary Kotton 2018-01-23 02:16:06 -08:00
parent a277bbc6ad
commit 989e777ab4
1 changed files with 3 additions and 3 deletions

View File

@ -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)