Move zone:check to debug namespace, add address:check command
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 35s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m37s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2024-04-21 22:10:12 +10:00
parent bba6f93fbc
commit 001618d719
2 changed files with 39 additions and 6 deletions

View File

@ -0,0 +1,32 @@
<?php
namespace App\Console\Commands\Debug;
use Illuminate\Console\Command;
use App\Models\Address;
class AddressCheck extends Command
{
protected $signature = 'debug:address:check'
.' {ftn : FTN}';
protected $description = 'Check the addresses we use for a node';
public function handle()
{
$o = Address::findFTN($this->argument('ftn'));
if (! $o) {
$this->error(sprintf('Address: %s doesnt exist?',$this->argument('ftn')));
return Command::FAILURE;
}
$this->info(sprintf('Address: %s',$o->ftn));
$this->info(sprintf('Uplink: %s',$o->parent()?->ftn));
$this->info(sprintf('Our Address: %s',our_address($o)?->ftn));
$this->info(sprintf('Domain Addresses: %s',our_address($o->zone->domain)->pluck('ftn4d')->join(',')));
return Command::SUCCESS;
}
}

View File

@ -1,14 +1,14 @@
<?php <?php
namespace App\Console\Commands; namespace App\Console\Commands\Debug;
use App\Models\{Domain};
use App\Models\Address;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use App\Models\{Address,Domain};
class ZoneCheck extends Command class ZoneCheck extends Command
{ {
protected $signature = 'zone:check' protected $signature = 'debug:zone:check'
.' {domain : Domain Name}' .' {domain : Domain Name}'
.' {--Z|zone= : Zone}'; .' {--Z|zone= : Zone}';
@ -25,12 +25,13 @@ class ZoneCheck extends Command
$this->warn('Zone: '.$zo->zone_id); $this->warn('Zone: '.$zo->zone_id);
$this->info(sprintf('- Our address(es): %s',our_address($do)->pluck('ftn4d')->join(','))); $this->info(sprintf('- Our address(es): %s',our_address($do)->pluck('ftn4d')->join(',')));
$this->table(['id','ftn','role','parent','region_id','host_id','hub_id','system','notes'],$zo->addresses()->FTNorder()->active()->with(['system'])->get()->transform(function($item) { $this->table(['id','ftn','role','parent','our_address','region_id','host_id','hub_id','system','notes'],$zo->addresses()->FTNorder()->active()->with(['system'])->get()->transform(function($item) {
return [ return [
'id'=>$item->id, 'id'=>$item->id,
'ftn'=>$item->ftn4d, 'ftn'=>$item->ftn4d,
'role'=>$item->role_name, 'role'=>$item->role_name,
'parent'=>$item->parent()?->ftn4d, 'parent'=>($x=$item->parent())?->ftn4d,
'our_address'=>$x ? our_address($item->parent())->ftn4d : '',
'region_id'=>$item->region_id, 'region_id'=>$item->region_id,
'host_id'=>$item->host_id, 'host_id'=>$item->host_id,
'hub_id'=>$item->hub_id, 'hub_id'=>$item->hub_id,