Fix nodelist segment being sent from queue where gethostname() is only a container name, added ability to control filename when sending nodelist segment
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m38s
Create Docker Image / Final Docker Image Manifest (push) Successful in 9s

This commit is contained in:
Deon George 2025-03-18 17:18:28 +11:00
parent 3797f3c7c5
commit 2458ca2408
3 changed files with 12 additions and 11 deletions

View File

@ -18,7 +18,7 @@ class NodelistSegment extends Dynamic
{ {
private const LOGKEY = 'DNL'; private const LOGKEY = 'DNL';
private string $name = ''; private ?string $name;
private Address $our_address; private Address $our_address;
private Carbon $now; private Carbon $now;
@ -27,11 +27,7 @@ class NodelistSegment extends Dynamic
$this->our_address = our_address($ao->zone->domain)->first(); $this->our_address = our_address($ao->zone->domain)->first();
$this->now = Carbon::now(); $this->now = Carbon::now();
$this->name = sprintf('z%dn%d.%d', $this->name = $arg->get('name','');
$this->our_address->zone->zone_id,
$this->our_address->host_id,
$this->now->format('z'),
);
Log::debug(sprintf('%s:- Generating Nodelist for [%s] from [%s] as [%s] with arguments',self::LOGKEY,$ao->ftn,$this->our_address->ftn,$this->our_address->role_name),['args'=>$arg]); Log::debug(sprintf('%s:- Generating Nodelist for [%s] from [%s] as [%s] with arguments',self::LOGKEY,$ao->ftn,$this->our_address->ftn,$this->our_address->role_name),['args'=>$arg]);
} }
@ -157,6 +153,8 @@ class NodelistSegment extends Dynamic
public function getName(): string public function getName(): string
{ {
return $this->name; return ($this->name ?: sprintf('z%dn%d',
$this->our_address->zone->zone_id,
$this->our_address->host_id)).'.'.sprintf('%03d',$this->now->format('z'));
} }
} }

View File

@ -26,7 +26,9 @@ class DynamicItem extends Command
$d = new Dynamic($do,$do->address,Send::T_FILE); $d = new Dynamic($do,$do->address,Send::T_FILE);
$d->open(); $d->open();
echo $d->read($d->size); echo $d->read($d->size)."\n";
$this->alert('File sent as:'.$d->nameas);
return self::SUCCESS; return self::SUCCESS;
} }

View File

@ -141,22 +141,23 @@ function our_address(Domain|Address $o=NULL): Collection|Address|NULL
function our_hostname(Address $o): string function our_hostname(Address $o): string
{ {
$our = our_address($o->domain)->first(); $our = our_address($o->domain)->first();
$ourhostname = $our->system->address;
switch ($our->role_id) { switch ($our->role_id) {
case Address::NODE_ZC: case Address::NODE_ZC:
$domain = collect(explode('.',gethostname()))->forget(0) $domain = collect(explode('.',$ourhostname))->forget(0)
->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_RC:
case Address::NODE_NC: case Address::NODE_NC:
$domain = collect(explode('.',gethostname()))->forget(0) $domain = collect(explode('.',$ourhostname))->forget(0)
->prepend(sprintf('z%d',$our->zone->zone_id)) ->prepend(sprintf('z%d',$our->zone->zone_id))
->prepend(sprintf('n%d',$our->host_id)); ->prepend(sprintf('n%d',$our->host_id));
break; break;
case Address::NODE_HC: case Address::NODE_HC:
$domain = collect(explode('.',gethostname()))->forget(0) $domain = collect(explode('.',$ourhostname))->forget(0)
->prepend(sprintf('z%d',$our->zone->zone_id)) ->prepend(sprintf('z%d',$our->zone->zone_id))
->prepend(sprintf('n%d',$our->host_id)) ->prepend(sprintf('n%d',$our->host_id))
->prepend(sprintf('f%d',$our->node_id)); ->prepend(sprintf('f%d',$our->node_id));