Skip to content

Commit fc5c855

Browse files
committed
Merge branch 'release-v7' of github.com:islandbridgenetworks/ibn-ixp-manager into release-v7
2 parents 5fa7f97 + 955c1e4 commit fc5c855

File tree

5 files changed

+213
-30
lines changed

5 files changed

+213
-30
lines changed

app/Console/Commands/Irrdb/UpdateAsnDb.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@
2626
use Exception;
2727
use IXP\Tasks\Irrdb\UpdateAsnDb as UpdateAsnDbTask;
2828

29-
/**
30-
* Artisan command to update the IRRDB ASN database
31-
*
32-
* @author Barry O'Donovan <[email protected]>
33-
* @author Yann Robin <[email protected]>
34-
* @category Irrdb
35-
* @package IXP\Console\Commands
36-
* @copyright Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee
37-
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
38-
*/
29+
/**
30+
* Artisan command to update the IRRDB ASN database
31+
*
32+
* @author Barry O'Donovan <[email protected]>
33+
* @author Yann Robin <[email protected]>
34+
* @author Laszlo Kiss <[email protected]>
35+
* @category Irrdb
36+
* @package IXP\Console\Commands
37+
* @copyright Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee
38+
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
39+
*/
3940
class UpdateAsnDb extends UpdateDb
4041
{
4142
/**
@@ -45,7 +46,8 @@ class UpdateAsnDb extends UpdateDb
4546
*/
4647
protected $signature = 'irrdb:update-asn-db
4748
{--asn= : Only update the member with this ASN}
48-
{--id= : Only update the member with this customer ID}';
49+
{--id= : Only update the member with this customer ID}
50+
{--alert-email : If set, send an alert email to IDENTITY_ALERTS_EMAIL on error}';
4951

5052
/**
5153
* The console command description.
@@ -72,14 +74,12 @@ public function handle(): int
7274
foreach( $customers as $c ) {
7375
try {
7476
$task = new UpdateAsnDbTask( $c );
77+
$this->printResults( $c, $task->update(), 'asn' );
7578
} catch( Exception $e ) {
76-
$this->error( "IRRDB ASN update failed for {$c->name}/AS{$c->autsys}" );
77-
$this->error( $e->getMessage() );
79+
$this->handleException( $c, $e, 'ASN' );
7880
$this->info( "Continuing to next customer...");
7981
continue;
8082
}
81-
82-
$this->printResults( $c, $task->update(), 'asn' );
8383
}
8484

8585
if( count( $customers ) > 1 && $this->isVerbosityVerbose() ) {

app/Console/Commands/Irrdb/UpdatePrefixDb.php

+16-15
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@
2626
use Exception;
2727
use IXP\Tasks\Irrdb\UpdatePrefixDb as UpdatePrefixDbTask;
2828

29-
/**
30-
* Artisan command to update the IRRDB prefix database
31-
*
32-
* @author Barry O'Donovan <[email protected]>
33-
* @author Yann Robin <[email protected]>
34-
* @category Irrdb
35-
* @package IXP\Console\Commands
36-
* @copyright Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee
37-
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
38-
*/
29+
/**
30+
* Artisan command to update the IRRDB prefix database
31+
*
32+
* @author Barry O'Donovan <[email protected]>
33+
* @author Yann Robin <[email protected]>
34+
* @author Laszlo Kiss <[email protected]>
35+
* @category Irrdb
36+
* @package IXP\Console\Commands
37+
* @copyright Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee
38+
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
39+
*/
3940
class UpdatePrefixDb extends UpdateDb
4041
{
4142
/**
@@ -45,7 +46,9 @@ class UpdatePrefixDb extends UpdateDb
4546
*/
4647
protected $signature = 'irrdb:update-prefix-db
4748
{--asn= : Only update the member with this ASN}
48-
{--id= : Only update the member with this customer ID}';
49+
{--id= : Only update the member with this customer ID}
50+
{--alert-email : If set, send an alert email to IDENTITY_ALERTS_EMAIL on error}';
51+
4952

5053
/**
5154
* The console command description.
@@ -72,14 +75,12 @@ public function handle(): int
7275
foreach( $customers as $c ) {
7376
try {
7477
$task = new UpdatePrefixDbTask( $c );
78+
$this->printResults( $c, $task->update(), 'prefix' );
7579
} catch( Exception $e ) {
76-
$this->error( "IRRDB ASN update failed for {$c->name}/AS{$c->autsys}" );
77-
$this->error( $e->getMessage() );
80+
$this->handleException( $c, $e, 'ASN' );
7881
$this->info( "Continuing to next customer...");
7982
continue;
8083
}
81-
82-
$this->printResults( $c, $task->update(), 'prefix' );
8384
}
8485

8586

app/Events/User/UserWarning.php

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?php
2+
3+
namespace IXP\Events\User;
4+
5+
/*
6+
* Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee.
7+
* All Rights Reserved.
8+
*
9+
* This file is part of IXP Manager.
10+
*
11+
* IXP Manager is free software: you can redistribute it and/or modify it
12+
* under the terms of the GNU General Public License as published by the Free
13+
* Software Foundation, version v2.0 of the License.
14+
*
15+
* IXP Manager is distributed in the hope that it will be useful, but WITHOUT
16+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18+
* more details.
19+
*
20+
* You should have received a copy of the GNU General Public License v2.0
21+
* along with IXP Manager. If not, see:
22+
*
23+
* http://www.gnu.org/licenses/gpl-2.0.html
24+
*/
25+
26+
use Illuminate\Contracts\Queue\ShouldQueue;
27+
use Illuminate\Queue\InteractsWithQueue;
28+
use Illuminate\Queue\SerializesModels;
29+
use Illuminate\Foundation\Events\Dispatchable;
30+
31+
/**
32+
* User Warning Event
33+
* @author Barry O'Donovan <[email protected]>
34+
* @author Yann Robin <[email protected]>
35+
* @author Laszlo Kiss <[email protected]>
36+
* @category Events\User
37+
* @copyright Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee
38+
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
39+
*/
40+
class UserWarning implements ShouldQueue
41+
{
42+
use Dispatchable, SerializesModels, InteractsWithQueue;
43+
44+
/**
45+
* @var string
46+
* @var string
47+
*/
48+
public string $warningTitle;
49+
public string $errorMessage;
50+
51+
/**
52+
* Create a new event instance.
53+
*
54+
* @param string $warningTitle
55+
* @param string $errorMessage
56+
*/
57+
public function __construct( string $warningTitle, string $errorMessage )
58+
{
59+
$this->warningTitle = $warningTitle;
60+
$this->errorMessage = $errorMessage;
61+
}
62+
63+
/**
64+
* Get asn string
65+
*
66+
* @return string
67+
*/
68+
public function getTitle(): string
69+
{
70+
return $this->warningTitle;
71+
}
72+
73+
/**
74+
* Get error message string
75+
*
76+
* @return string
77+
*/
78+
public function getErrorMessage(): string
79+
{
80+
return $this->errorMessage;
81+
}
82+
}

app/Mail/User/UserWarning.php

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
namespace IXP\Mail\User;
4+
5+
/*
6+
* Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee.
7+
* All Rights Reserved.
8+
*
9+
* This file is part of IXP Manager.
10+
*
11+
* IXP Manager is free software: you can redistribute it and/or modify it
12+
* under the terms of the GNU General Public License as published by the Free
13+
* Software Foundation, version v2.0 of the License.
14+
*
15+
* IXP Manager is distributed in the hope that it will be useful, but WITHOUT
16+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18+
* more details.
19+
*
20+
* You should have received a copy of the GNU General Public License v2.0
21+
* along with IXP Manager. If not, see:
22+
*
23+
* http://www.gnu.org/licenses/gpl-2.0.html
24+
*/
25+
use Illuminate\Bus\Queueable;
26+
use Illuminate\Mail\Mailable;
27+
use Illuminate\Queue\SerializesModels;
28+
use IXP\Events\User\UserWarning as UserWarningEvent;
29+
30+
/**
31+
* Mailable for warning email User
32+
*
33+
* @author Barry O'Donovan <[email protected]>
34+
* @author Yann Robin <[email protected]>
35+
* @author Laszlo Kiss <[email protected]>
36+
* @category User
37+
* @package IXP\Mail\User
38+
* @copyright Copyright (C) 2009 - 2020 Internet Neutral Exchange Association Company Limited By Guarantee
39+
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL V2.0
40+
*/
41+
class UserWarning extends Mailable
42+
{
43+
use Queueable, SerializesModels;
44+
45+
/**
46+
*
47+
* @var UserWarningEvent
48+
*/
49+
public UserWarningEvent $event;
50+
51+
public string $warningTitle;
52+
public string $errorMessage;
53+
54+
/**
55+
* Create a new message instance.
56+
*
57+
* @param UserWarningEvent $e
58+
*
59+
* @return void
60+
*/
61+
public function __construct( UserWarningEvent $e )
62+
{
63+
$this->event = $e;
64+
}
65+
66+
/**
67+
* Build the message.
68+
*
69+
* @return $this
70+
*/
71+
public function build(): self
72+
{
73+
$this->warningTitle = $this->event->getTitle();
74+
$this->errorMessage = $this->event->getErrorMessage();
75+
76+
return $this->markdown( 'user.emails.warning' )->subject( config('identity.sitename' ) . " - Warning" );
77+
}
78+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
@component('mail::message')
2+
3+
## Warning Message
4+
5+
{{ $warningTitle }}
6+
7+
@component('mail::panel')
8+
{{ $errorMessage }}
9+
@endcomponent
10+
11+
@component('mail::subcopy')
12+
&nbsp;
13+
@endcomponent
14+
15+
Thanks and kind regards,
16+
17+
18+
{{ config( 'identity.name' ) }}
19+
20+
[{{ config( 'identity.email' ) }}](mailto:{{ config( 'identity.email' ) }})
21+
22+
@endcomponent

0 commit comments

Comments
 (0)