2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-05 10:17:51 +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 a0995b63ba
commit 8b0fb03c66
@@ -1389,7 +1389,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
@@ -1411,12 +1411,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': {}}