Merge "Return HTTP response for delete_access_rule."

This commit is contained in:
Zuul 2023-07-26 17:16:20 +00:00 committed by Gerrit Code Review
commit d264526ed1
2 changed files with 8 additions and 5 deletions

View File

@ -816,10 +816,11 @@ class Proxy(proxy.Proxy):
:param access_id: The id of the access rule to get :param access_id: The id of the access rule to get
:param share_id: The ID of the share :param share_id: The ID of the share
:rtype: ``None`` :rtype: ``requests.models.Response`` HTTP response from internal
requests client
""" """
res = self._get_resource(_share_access_rule.ShareAccessRule, access_id) res = self._get_resource(_share_access_rule.ShareAccessRule, access_id)
res.delete(self, share_id, ignore_missing=ignore_missing) return res.delete(self, share_id, ignore_missing=ignore_missing)
def share_group_snapshots(self, details=True, **query): def share_group_snapshots(self, details=True, **query):
"""Lists all share group snapshots. """Lists all share group snapshots.

View File

@ -63,7 +63,7 @@ class ShareAccessRule(resource.Resource):
if microversion is None: if microversion is None:
microversion = self._get_microversion(session, action=action) microversion = self._get_microversion(session, action=action)
session.post( return session.post(
url, json=body, headers=headers, microversion=microversion url, json=body, headers=headers, microversion=microversion
) )
@ -76,10 +76,12 @@ class ShareAccessRule(resource.Resource):
) )
def delete(self, session, share_id, ignore_missing=True): def delete(self, session, share_id, ignore_missing=True):
body = {'deny_access': {'access_id': self.id}} body = {"deny_access": {"access_id": self.id}}
url = utils.urljoin('/shares', share_id, 'action') url = utils.urljoin("/shares", share_id, "action")
response = self._action(session, body, url)
try: try:
response = self._action(session, body, url) response = self._action(session, body, url)
self._translate_response(response)
except exceptions.ResourceNotFound: except exceptions.ResourceNotFound:
if not ignore_missing: if not ignore_missing:
raise raise