2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-21 16:39:32 +00:00

Check for a deleted account without the cache

The delete that failed left the account collection cached as it was, so
asking whether the account is gone could only ever answer no.
This commit is contained in:
Markus Hilger
2026-08-15 12:58:16 +02:00
parent 307a1020a2
commit 24e8cd7e00
2 changed files with 9 additions and 5 deletions
+5 -4
View File
@@ -321,17 +321,18 @@ class Command(object):
}
return names
async def _account_url_info_by_id(self, uid):
async def _account_url_info_by_id(self, uid, cache=True):
srvurl = await self._accountserviceurl()
oem = await self.oem()
if srvurl:
srvinfo = await self._do_web_request(srvurl)
srvinfo = await self._do_web_request(srvurl, cache=cache)
srvurl = srvinfo.get('Accounts', {}).get('@odata.id', None)
if srvurl:
srvinfo = await self._do_web_request(srvurl)
srvinfo = await self._do_web_request(srvurl, cache=cache)
accounts = srvinfo.get('Members', [])
for account in accounts:
accinfo = await self._do_web_request(account['@odata.id'])
accinfo = await self._do_web_request(account['@odata.id'],
cache=cache)
currid = accinfo.get('Id', None)
if str(currid) == str(uid):
accinfo['expiration'] = await oem.get_user_expiration(
@@ -795,7 +795,10 @@ class OEMHandler(object):
# that is for
break
await asyncio.sleep(3)
if not await fishclient._account_url_info_by_id(uid):
# Uncached: a delete that failed left the account collection in the
# url cache as it was before, and answering this from that snapshot
# could only ever say the account is still there
if not await fishclient._account_url_info_by_id(uid, cache=False):
return True
try:
await fishclient.set_user_password(uid, base64.b64encode(os.urandom(15)))