Fix working out our hostname when we are an RC

This commit is contained in:
Deon George 2024-10-20 11:49:34 +11:00
parent 7ba037b76d
commit 432a9bbf2b
2 changed files with 3 additions and 2 deletions

View File

@ -59,7 +59,7 @@ class NodelistSegment extends Dynamic
$result->push('CM'); $result->push('CM');
if ($ao->system->address) { if ($ao->system->address) {
$result->push(sprintf('INA:%s',$ao->system->address)); $result->push(sprintf('INA:%s',our_address($ao->domain)->contains($ao->id) ? our_hostname($ao) : $ao->system->address));
if (($x=$ao->system->mailers->pluck('name')->search('BINKP')) !== FALSE) if (($x=$ao->system->mailers->pluck('name')->search('BINKP')) !== FALSE)
$result->push(sprintf('IBN%s',(($y=$ao->system->mailers->get($x)->pivot->port) !== 24554) ? ':'.$y : '')); $result->push(sprintf('IBN%s',(($y=$ao->system->mailers->get($x)->pivot->port) !== 24554) ? ':'.$y : ''));

View File

@ -100,7 +100,7 @@ function our_address(Domain|Address $o=NULL): Collection|Address|NULL
$our = Cache::remember(sprintf('%d-akas',$so->system_id),60,function() use ($so) { $our = Cache::remember(sprintf('%d-akas',$so->system_id),60,function() use ($so) {
$so->load([ $so->load([
'system:id,name', 'system:id,name',
'system.akas:addresses.id,addresses.zone_id,host_id,node_id,point_id,addresses.system_id,addresses.active,role', 'system.akas:addresses.id,addresses.zone_id,region_id,host_id,node_id,point_id,addresses.system_id,addresses.active,role',
'system.akas.zone:id,domain_id,zone_id', 'system.akas.zone:id,domain_id,zone_id',
'system.akas.zone.domain:id,name', 'system.akas.zone.domain:id,name',
]); ]);
@ -150,6 +150,7 @@ function our_hostname(Address $o): string
->prepend(sprintf('z%d',$our->zone->zone_id)); ->prepend(sprintf('z%d',$our->zone->zone_id));
break; break;
case Address::NODE_RC:
case Address::NODE_NC: case Address::NODE_NC:
$domain = collect(explode('.',gethostname()))->forget(0) $domain = collect(explode('.',gethostname()))->forget(0)
->prepend(sprintf('z%d',$our->zone->zone_id)) ->prepend(sprintf('z%d',$our->zone->zone_id))