HaraldGustafsson commented on issue #2880: Unauthorised when deleting namespace with superuser role URL: https://github.com/apache/pulsar/issues/2880#issuecomment-452283653 @ivankelly yes, I'm using the REST API directly from a Python client. Here is the method that delete the namespace: async def namespace_remove(self, tenant, namespace): retry = 20 while retry > 0: try: # Get topics ns_path = "{prefix}/persistent/{tenant}/{namespace}".format( prefix=self.path_prefix, namespace=namespace, tenant=tenant) async with self.session1.get(ns_path, **self._extra_args()) as resp: try: topics = await resp.json() topics = [t.split("/", 4)[-1] for t in topics] except: topics = [] text = await resp.text() _log.exception("Failed getting topic list when deleting namespace {} {}".format(resp.status, text)) _log.debug("pulsar broker namespace topics status {} {}".format(resp.status, topics)) # Remove topics if topics: await self.topic_remove(tenant, namespace, topics) #Delete namespace ns_path = "{prefix}/namespaces/{tenant}/{namespace}".format( prefix=self.path_prefix, namespace=namespace, tenant=tenant) _log.debug("pulsar broker namespace remove {}".format(ns_path)) async with self.session1.delete(ns_path, **self._extra_args()) as resp: _log.debug("pulsar broker namespace delete status {} {}".format(resp.status, await resp.text())) status = resp.status return status except OSError as error: if error.errno == 24: # Too many files open, retry retry -= 1 await asyncio.sleep(0.5) continue _log.exception("Failed namespace_remove") return hs.INTERNAL_SERVER_ERROR except Exception as error: _log.exception("Failed namespace_remove") return hs.INTERNAL_SERVER_ERROR The `self.session1` has a session pool of size 1 so only one simultaneous Admin API call.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
