Fix nodelist segment being sent from queue where gethostname() is only a container name, added ability to control filename when sending nodelist segment
This commit is contained in:
parent
3797f3c7c5
commit
2458ca2408
@ -18,7 +18,7 @@ class NodelistSegment extends Dynamic
|
||||
{
|
||||
private const LOGKEY = 'DNL';
|
||||
|
||||
private string $name = '';
|
||||
private ?string $name;
|
||||
private Address $our_address;
|
||||
private Carbon $now;
|
||||
|
||||
@ -27,11 +27,7 @@ class NodelistSegment extends Dynamic
|
||||
$this->our_address = our_address($ao->zone->domain)->first();
|
||||
$this->now = Carbon::now();
|
||||
|
||||
$this->name = sprintf('z%dn%d.%d',
|
||||
$this->our_address->zone->zone_id,
|
||||
$this->our_address->host_id,
|
||||
$this->now->format('z'),
|
||||
);
|
||||
$this->name = $arg->get('name','');
|
||||
|
||||
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
|
||||
{
|
||||
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'));
|
||||
}
|
||||
}
|
@ -26,7 +26,9 @@ class DynamicItem extends Command
|
||||
$d = new Dynamic($do,$do->address,Send::T_FILE);
|
||||
|
||||
$d->open();
|
||||
echo $d->read($d->size);
|
||||
echo $d->read($d->size)."\n";
|
||||
|
||||
$this->alert('File sent as:'.$d->nameas);
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
@ -141,22 +141,23 @@ function our_address(Domain|Address $o=NULL): Collection|Address|NULL
|
||||
function our_hostname(Address $o): string
|
||||
{
|
||||
$our = our_address($o->domain)->first();
|
||||
$ourhostname = $our->system->address;
|
||||
|
||||
switch ($our->role_id) {
|
||||
case Address::NODE_ZC:
|
||||
$domain = collect(explode('.',gethostname()))->forget(0)
|
||||
$domain = collect(explode('.',$ourhostname))->forget(0)
|
||||
->prepend(sprintf('z%d',$our->zone->zone_id));
|
||||
break;
|
||||
|
||||
case Address::NODE_RC:
|
||||
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('n%d',$our->host_id));
|
||||
break;
|
||||
|
||||
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('n%d',$our->host_id))
|
||||
->prepend(sprintf('f%d',$our->node_id));
|
||||
|
Loading…
x
Reference in New Issue
Block a user