2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-07-18 00:16:50 +00:00

Disable implicit tenant creation

If we support more tenants, we will modify that branch.
This commit is contained in:
Jarrod Johnson
2026-07-16 12:39:22 -04:00
parent 66347a937e
commit 7347125b6f
@@ -1382,7 +1382,7 @@ class ConfigManager(object):
return _cfgstore['main']
return _cfgstore['tenant'][self.tenant]
def __init__(self, tenant, decrypt=False, username=None):
def __init__(self, tenant, decrypt=False, username=None, create_tenant=False):
self.clientfiles = {}
global _cfgstore
self.inrestore = False
@@ -1404,12 +1404,14 @@ class ConfigManager(object):
self._cfgstore['nodes'] = {}
self._bg_sync_to_file()
return
elif 'tenant' not in _cfgstore:
elif 'tenant' not in _cfgstore and create_tenant:
_cfgstore['tenant'] = {tenant: {}}
self._bg_sync_to_file()
elif tenant not in _cfgstore['tenant']:
elif tenant not in _cfgstore['tenant'] and create_tenant:
_cfgstore['tenant'][tenant] = {}
self._bg_sync_to_file()
elif tenant and tenant not in _cfgstore.get('tenant', {}):
raise ValueError("Tenant {0} does not exist".format(tenant))
self.tenant = tenant
if 'nodegroups' not in self._cfgstore:
self._cfgstore['nodegroups'] = {'everything': {}}