Fix for when msgid address is from an unknown zone
This commit is contained in:
parent
9462e66a1c
commit
f91778b515
@ -426,28 +426,33 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
if ($msg->errors) {
|
if ($msg->errors) {
|
||||||
// If the from address doenst exist, we'll create a new entry
|
// If the from address doenst exist, we'll create a new entry
|
||||||
if ($msg->errors->messages()->has('from')) {
|
if ($msg->errors->messages()->has('from')) {
|
||||||
Log::alert(sprintf('%s: - From FTN is not defined, creating new entry for [%s]',self::LOGKEY,$msg->fboss));
|
$e = NULL;
|
||||||
|
|
||||||
Address::unguard();
|
try {
|
||||||
$ao = Address::firstOrNew([
|
Address::unguard();
|
||||||
'zone_id' => $msg->fzone->id,
|
$ao = Address::firstOrNew([
|
||||||
'region_id' => 0,
|
'zone_id' => $msg->fzone->id,
|
||||||
'host_id' => $msg->fn,
|
'region_id' => 0,
|
||||||
'node_id' => $msg->ff,
|
'host_id' => $msg->fn,
|
||||||
'point_id' => $msg->fp,
|
'node_id' => $msg->ff,
|
||||||
]);
|
'point_id' => $msg->fp,
|
||||||
Address::reguard();
|
]);
|
||||||
|
Address::reguard();
|
||||||
|
|
||||||
$ao->active = TRUE;
|
} catch (\Exception $e) {
|
||||||
$ao->role = DomainController::NODE_UNKNOWN;
|
Log::error(sprintf('%s:! Error finding/creating address [%s] for message',self::LOGKEY,$msg->fboss));
|
||||||
|
}
|
||||||
|
|
||||||
// This shouldnt happen
|
// This shouldnt happen
|
||||||
if ($ao->exists) {
|
if ($e || $ao->exists) {
|
||||||
Log::error(sprintf('%s: - Attempting to create address [%s], but it exists?',self::LOGKEY,$msg->fboss));
|
Log::error(sprintf('%s:! Attempting to create address [%s], but it exists?',self::LOGKEY,$msg->fboss));
|
||||||
$this->errors->push($msg);
|
$this->errors->push($msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ao->active = TRUE;
|
||||||
|
$ao->role = DomainController::NODE_UNKNOWN;
|
||||||
|
|
||||||
System::unguard();
|
System::unguard();
|
||||||
$so = System::firstOrCreate([
|
$so = System::firstOrCreate([
|
||||||
'name' => 'Discovered System',
|
'name' => 'Discovered System',
|
||||||
@ -459,6 +464,8 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
|
|
||||||
$so->addresses()->save($ao);
|
$so->addresses()->save($ao);
|
||||||
|
|
||||||
|
Log::alert(sprintf('%s: - From FTN is not defined, creating new entry for [%s] (%d)',self::LOGKEY,$msg->fboss,$ao->id));
|
||||||
|
|
||||||
} elseif($msg->errors->messages()->has('user_from') || $msg->errors->messages()->has('user_to')) {
|
} elseif($msg->errors->messages()->has('user_from') || $msg->errors->messages()->has('user_to')) {
|
||||||
Log::error(sprintf('%s:! Skipping message [%s] due to errors (%s)...',self::LOGKEY,$msg->msgid,join(',',$msg->errors->messages()->keys())));
|
Log::error(sprintf('%s:! Skipping message [%s] due to errors (%s)...',self::LOGKEY,$msg->msgid,join(',',$msg->errors->messages()->keys())));
|
||||||
$this->errors->push($msg);
|
$this->errors->push($msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user