Ensure retry on stale resources for exclude list updates

Change-Id: I075243c5a946ba03178f0d1e36c7d6b74819af88
This commit is contained in:
Gary Kotton 2017-08-15 16:25:27 -07:00 committed by garyk
parent 4a47faeea8
commit 0d5da8224c

View File

@ -227,15 +227,27 @@ class NsxLibNsGroup(utils.NsxLibApiBase):
class NsxLibFirewallSection(utils.NsxLibApiBase):
def add_member_to_fw_exclude_list(self, target_id, target_type):
resource = 'firewall/excludelist?action=add_member'
body = {"target_id": target_id,
"target_type": target_type}
self.client.create(resource, body)
@utils.retry_upon_exception(
exceptions.StaleRevision,
max_attempts=self.nsxlib_config.max_attempts)
def _add_member_to_fw_exclude_list():
resource = 'firewall/excludelist?action=add_member'
body = {"target_id": target_id,
"target_type": target_type}
self.client.create(resource, body)
_add_member_to_fw_exclude_list()
def remove_member_from_fw_exclude_list(self, target_id, target_type):
resource = ('firewall/excludelist?action=remove_member&object_id='
+ target_id)
self.client.create(resource)
@utils.retry_upon_exception(
exceptions.StaleRevision,
max_attempts=self.nsxlib_config.max_attempts)
def _remove_member_from_fw_exclude_list():
resource = ('firewall/excludelist?action=remove_member&object_id='
+ target_id)
self.client.create(resource)
_remove_member_from_fw_exclude_list()
def get_excludelist(self):
return self.client.list('firewall/excludelist')