From ea5696da2cf2352179b1346a3eb9556bc7371ca5 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 10 Oct 2013 18:28:06 +0200 Subject: [PATCH] Revert "MT#4229 custom Internal server error page" This reverts commit eece093fd0414c9004bf0ba9bb994345eee9c90d. Otherwise fails with: | Starting NGCP-Panel Webapp: ngcp_panel_fastcgi:Can't locate Convert/Ascii85.pm in your Perl library. You may need to install it | from CPAN or another repository. Your library paths are: | /etc/perl | /usr/local/lib/perl/5.14.2 | /usr/local/share/perl/5.14.2 | /usr/lib/perl5 | /usr/share/perl5 | /usr/lib/perl/5.14 | /usr/share/perl/5.14 | /usr/local/lib/site_perl | . | | BEGIN failed--compilation aborted at /usr/share/perl5/NGCP/Panel/Controller/Root.pm line 5. | Compilation failed in require at /usr/share/perl5/Catalyst/Utils.pm line 308. | Compilation failed in require at /usr/share/perl5/Module/Runtime.pm line 317. | at /usr/share/perl5/Catalyst/ScriptRunner.pm line 50 | error ... failed! because Convert::Ascii85 isn't available yet in our repositories, therefore revert to fix broken trunk. Acked-by: Andreas Granig Git-Dch: Ignore --- Build.PL | 8 ----- lib/NGCP/Panel/Controller/Root.pm | 49 ++++--------------------------- ngcp_panel.conf | 3 -- script/ngcp_panel_decode_crash | 21 ------------- share/templates/error_page.tt | 11 ++----- share/templates/notfound_page.tt | 37 ----------------------- 6 files changed, 9 insertions(+), 120 deletions(-) delete mode 100755 script/ngcp_panel_decode_crash delete mode 100644 share/templates/notfound_page.tt diff --git a/Build.PL b/Build.PL index a92de0cffb..4c7c31a97f 100644 --- a/Build.PL +++ b/Build.PL @@ -32,12 +32,9 @@ my $builder = Local::Module::Build->new( 'Catalyst::View::JSON' => 0, 'Catalyst::View::TT' => 0, 'Config::General' => 0, - 'Convert::Ascii85' => 0, - 'Data::Dumper' => 0, 'Data::Validate::IP' => 0, 'DateTime' => 0, 'DateTime::Format::ISO8601' => 0, - 'DateTime::Format::RFC3339' => 0, 'DBIx::Class::ResultSet::RecursiveUpdate' => '0.30', 'Email::Valid' => 0, 'File::ShareDir' => 0, @@ -52,7 +49,6 @@ my $builder = Local::Module::Build->new( 'HTML::FormHandler::Moose' => 0, 'HTML::FormHandler::Widget::Block::Bootstrap' => 0, 'HTTP::Status' => 0, - 'IO::Compress::Xz' => 0, 'IPC::System::Simple' => 0, 'Log::Log4perl::Catalyst' => 0, 'Module::Runtime' => 0, @@ -69,7 +65,6 @@ my $builder = Local::Module::Build->new( 'strict' => 0, 'Template' => 0, 'Text::CSV_XS' => 0, - 'Time::HiRes' => 0, 'URI::Encode' => 0, 'URI::Escape' => 0, 'UUID' => 0, @@ -100,9 +95,6 @@ my $builder = Local::Module::Build->new( # for the testcover target 'Devel::Cover' => 0, 'sigtrap' => 0, - # for development - 'Convert::Ascii85' => 0, - 'IO::Uncompress::UnXz' => 0, }, add_to_cleanup => [ 'NGCP-Panel-*' ], ); diff --git a/lib/NGCP/Panel/Controller/Root.pm b/lib/NGCP/Panel/Controller/Root.pm index 7b00f826a6..4e54139888 100644 --- a/lib/NGCP/Panel/Controller/Root.pm +++ b/lib/NGCP/Panel/Controller/Root.pm @@ -1,15 +1,11 @@ package NGCP::Panel::Controller::Root; use Sipwise::Base; + + BEGIN { extends 'Catalyst::Controller' } -use Carp qw(longmess); -use Convert::Ascii85 qw(); -use Data::Dumper qw(Dumper); -use DateTime qw(); -use DateTime::Format::RFC3339 qw(); -use IO::Compress::Xz qw(xz); + use NGCP::Panel::Widget; use Scalar::Util qw(blessed); -use Time::HiRes qw(); # # Sets the actions in this controller to be registered with no prefix @@ -115,41 +111,7 @@ sub default :Path { $c->detach( '/error_page' ); } -sub render :ActionClass('RenderView') { } - -sub end :Private { - my ($self, $c) = @_; - $c->forward('render'); - if (@{ $c->error }) { - my $incident = DateTime->from_epoch(epoch => Time::HiRes::time); - my $incident_id = sprintf '%X', $incident->strftime('%s%N'); - my $incident_timestamp = DateTime::Format::RFC3339->new->format_datetime($incident); - my $crash_state; - if ($c->config->{log_crash_state}) { - local $Data::Dumper::Indent = 1; - local $Data::Dumper::Useqq = 1; - local $Data::Dumper::Deparse = 1; - local $Data::Dumper::Quotekeys = 0; - local $Data::Dumper::Sortkeys = 1; - my $buffer; - xz(\(join(q(), @{ $c->error }) . longmess . Dumper($c) . Dumper($c->config)), \$buffer); - $crash_state = Convert::Ascii85::encode($buffer); - $crash_state =~ s/(.{80})/$1\n/g; - } - $c->log->error( - "Exception id $incident_id at $incident_timestamp crash_state:" . - ($crash_state ? ("\n" . $crash_state) : ' disabled') - ); - $c->clear_errors; - $c->stash( - exception_incident => $incident_id, - exception_timestamp => $incident_timestamp, - template => 'error_page.tt' - ); - $c->response->status(500); - $c->detach($c->view); - } -} +sub end : ActionClass('RenderView') {} sub _prune_row { my ($columns, %row) = @_; @@ -167,7 +129,8 @@ sub error_page :Private { my ($self,$c) = @_; $c->log->error( 'Failed to find path ' . $c->request->path ); - $c->stash(template => 'notfound_page.tt'); + $c->stash(template => 'error_page.tt'); + #$c->response->body( 'Page not found' ); $c->response->status(404); } diff --git a/ngcp_panel.conf b/ngcp_panel.conf index 7b86c9f0b7..6975164a04 100644 --- a/ngcp_panel.conf +++ b/ngcp_panel.conf @@ -10,9 +10,6 @@ log4perl.appender.Default.layout=PatternLayout log4perl.appender.Default.layout.ConversionPattern=%d{ISO8601} [%p] [%F +%L] %m{chomp}%n # perhaps also add: host=%H pid=%P -# each crash state is <50 KiB -log_crash_state 1 - schema_class NGCP::Schema diff --git a/script/ngcp_panel_decode_crash b/script/ngcp_panel_decode_crash deleted file mode 100755 index 3440644722..0000000000 --- a/script/ngcp_panel_decode_crash +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env perl -use Convert::Ascii85 qw(); -use IO::Uncompress::UnXz qw(unxz $UnXzError); - -local $/ = undef; -my $buf = Convert::Ascii85::decode(<>); -my $out; -unxz \$buf, \$out or die $UnXzError; -print $out; - -__END__ - -=encoding UTF-8 - -=head1 NAME - -ngcp_panel_decode_crash - decode a crash state from the Web server error log - -=head1 USAGE - - ngcp_panel_decode_crash < crashfile diff --git a/share/templates/error_page.tt b/share/templates/error_page.tt index 7bf908312a..5556f10866 100644 --- a/share/templates/error_page.tt +++ b/share/templates/error_page.tt @@ -6,16 +6,11 @@

Oops!

-

[% c.response.status %] Internal server error

+

[% c.response.status %] Not found

-

Sorry, an exceptional error has occured:

-
    -
  • incident number: [% exception_incident %]
  • -
  • time of incident: [% exception_timestamp %]
  • -
-

Details have been logged on the server. If you want to report the error, - describe what you were doing or attempting to do just before.

+ Sorry, an error has occured, Requested page not found! +
diff --git a/share/templates/notfound_page.tt b/share/templates/notfound_page.tt deleted file mode 100644 index 5556f10866..0000000000 --- a/share/templates/notfound_page.tt +++ /dev/null @@ -1,37 +0,0 @@ -
- -
- -
- -

Oops!

- -

[% c.response.status %] Not found

- -
- Sorry, an error has occured, Requested page not found! - -
- - - -
- - -
- -
-