Dont enable rogue_path - it looses our true path for messages - instead create addresses in the path we dont know about.

This commit is contained in:
2023-09-15 16:59:46 +10:00
parent 6e133770fc
commit c1d6d48a3c
4 changed files with 38 additions and 19 deletions

View File

@@ -472,8 +472,16 @@ class Address extends Model
}
if ($create) {
if (! $so)
throw new \Exception(sprintf('%s:AKA create requested for [%s], but system not provided',self::LOGKEY,$address));
if (! $so) {
System::unguard();
$so = System::firstOrCreate([
'name' => 'Discovered System',
'sysop' => 'Unknown',
'location' => '',
'active' => TRUE,
]);
System::reguard();
}
if (! $ftn['d']) {
Log::alert(sprintf('%s:! Refusing to create address [%s] no domain available',self::LOGKEY,$address));
@@ -503,7 +511,7 @@ class Address extends Model
if (! $zo->exists) {
$zo->active = TRUE;
$zo->notes = 'Auto created';
$zo->system_id = System::where('name','Discovered System')->single()->id;
$zo->system_id = System::where('name','Discovered System')->first()->id;
$do->zones()->save($zo);
}
@@ -525,6 +533,7 @@ class Address extends Model
try {
$so->addresses()->save($o);
} catch (\Exception $e) {
Log::error(sprintf('%s:! ERROR creating address [%s] (%s)',self::LOGKEY,$x->toSql(),get_class($e)),['bindings'=>$x->getBindings()]);
return NULL;