_bootstrap_dns runs at container start before the wizard, writing the
default cell name ('mycell') into cell.zone. When the wizard completed
it fired IDENTITY_CHANGED for Caddy but never updated the DNS zone, so
DNS records kept showing 'mycell.cell' even after naming the cell.
After successful wizard completion, call network_manager.apply_cell_name
to rename the hostname record in the primary zone file, then reload
CoreDNS. The empty old_name triggers auto-detection so it works even
when the zone was written with the env-var default.
Adds test_setup_route.py covering: apply_cell_name called on success,
not called on failure, 410 on repeat completion, and IDENTITY_CHANGED
publication.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-2
@@ -90,15 +90,19 @@ def complete_setup():
|
||||
result = sm.complete_setup(payload)
|
||||
if result.get('success'):
|
||||
try:
|
||||
from app import config_manager, service_bus, EventType
|
||||
from app import config_manager, service_bus, EventType, network_manager
|
||||
identity = config_manager.configs.get('_identity', {})
|
||||
cell_name = identity.get('cell_name', '')
|
||||
service_bus.publish_event(EventType.IDENTITY_CHANGED, 'setup', {
|
||||
'cell_name': identity.get('cell_name'),
|
||||
'cell_name': cell_name,
|
||||
'domain': identity.get('domain'),
|
||||
'domain_name': identity.get('domain_name'),
|
||||
'domain_mode': identity.get('domain_mode'),
|
||||
'effective_domain': config_manager.get_effective_domain(),
|
||||
})
|
||||
# Bootstrap wrote the zone with 'mycell'; rename to the real cell name.
|
||||
if cell_name:
|
||||
network_manager.apply_cell_name('', cell_name)
|
||||
except Exception as exc:
|
||||
logger.warning(f'Failed to publish IDENTITY_CHANGED after setup: {exc}')
|
||||
status_code = 200 if result.get('success') else 400
|
||||
|
||||
Reference in New Issue
Block a user