mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-29 04:50:21 +00:00
For skipauth clients, allow a 'shutdown' verb
To facilitate a clean coordinated shutdown, create a verb so that a termination can be done and know when it is completed. Only allow for the 'special' case of 'skipauth', where unix domain socket connection is in hand and only root or the service owner can access.
This commit is contained in:
parent
a907da0532
commit
5012c9e401
@ -108,6 +108,8 @@ def authorize(name, element, tenant=False, operation='create',
|
||||
and the relevant ConfigManager object for the context of the
|
||||
request.
|
||||
"""
|
||||
if operation not in ('create', 'start', 'update', 'retrieve', 'delete'):
|
||||
return None
|
||||
user, tenant = _get_usertenant(name, tenant)
|
||||
if tenant is not None and not configmanager.is_tenant(tenant):
|
||||
return None
|
||||
|
@ -1123,6 +1123,13 @@ class ConfigManager(object):
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def shutdown(cls):
|
||||
cls._bg_sync_to_file()
|
||||
if cls._cfgwriter is not None:
|
||||
cls._cfgwriter.join()
|
||||
sys.exit(0)
|
||||
|
||||
@classmethod
|
||||
def _bg_sync_to_file(cls):
|
||||
with cls._syncstate:
|
||||
|
@ -184,6 +184,8 @@ def process_request(connection, request, cfm, authdata, authname, skipauth):
|
||||
consession.destroy()
|
||||
return
|
||||
consession.write(data)
|
||||
elif operation == 'shutdown':
|
||||
configmanager.ConfigManager.shutdown()
|
||||
else:
|
||||
hdlr = pluginapi.handle_path(path, operation, cfm, params)
|
||||
except exc.NotFoundException:
|
||||
|
Loading…
Reference in New Issue
Block a user