Title: [opsview] [10564] merge in 10560-10562
Revision
10564
Author
aburzynski
Date
2012-10-22 13:57:18 +0100 (Mon, 22 Oct 2012)

Log Message

merge in 10560-10562

Modified Paths


Added Paths

Property Changed


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/DEV-capside/release-3.9.0:6365-6370
/branches/DEV-extra-notification-data:6734-6746
/branches/DEV-odw-calculations:9016-9160
/branches/DEV-restapi-monitoringservers:9778
/branches/DEV-snmp-multi:7324-7376
/branches/US187:9403-9479
/branches/US198b:8875-8994
/branches/US310:9851-9873
/branches/enterprise/BRAN-3.14:6874,6882,6956
/branches/enterprise/DEV-professional:6494-8475,8477-8478,8486,8490,8492,8494,8499-8500,8515,8518-8519,8524,8527-8529,8531-8532,8536,8538,8540-8544,8547-8552,8554,8557,8600-8601,8637,8749,8772,8897,8917,8944-8945,8947,8950-8952,8967,8969,8979,8982,8987,8998,9006,9008,9011,9013,9026,9033-9036,9038,9040,9042,9044,9048,9050-9053,9062,9064-9065,9069,9078,9081,9088,9096,9099-9101,9103,9105,9115,9118,9347,9353-9354,9411,9432,9445,9486,9538-9550,9569-9571,9620,9635,9637-9638,9645-9647,9693,9699,9721,9814,9825,9857,9879,9881,9939,10002,10029,10038-10041,10070,10086,10093,10345,10347,10388,10407
/branches/nagvis-iframe:9764-9786
/branches/us168:8759,8762-8763,8766-8768,8770,8774-8777,8794,8798-8799,8801-8803,8821-8822,8834,8837-8838,8932,8937,8947,8969,8977,8981,9004,9007,9009-9010,9012,9024,9049
/commercial/branches/US306-slaves:9804-9823
/commercial/branches/US307-network-map:9685-9837
   + /branches/DEV-capside/release-3.9.0:6365-6370
/branches/DEV-extra-notification-data:6734-6746
/branches/DEV-odw-calculations:9016-9160
/branches/DEV-restapi-monitoringservers:9778
/branches/DEV-snmp-multi:7324-7376
/branches/US187:9403-9479
/branches/US198b:8875-8994
/branches/US310:9851-9873
/branches/enterprise/BRAN-3.14:6874,6882,6956
/branches/enterprise/DEV-professional:6494-8475,8477-8478,8486,8490,8492,8494,8499-8500,8515,8518-8519,8524,8527-8529,8531-8532,8536,8538,8540-8544,8547-8552,8554,8557,8600-8601,8637,8749,8772,8897,8917,8944-8945,8947,8950-8952,8967,8969,8979,8982,8987,8998,9006,9008,9011,9013,9026,9033-9036,9038,9040,9042,9044,9048,9050-9053,9062,9064-9065,9069,9078,9081,9088,9096,9099-9101,9103,9105,9115,9118,9347,9353-9354,9411,9432,9445,9486,9538-9550,9569-9571,9620,9635,9637-9638,9645-9647,9693,9699,9721,9814,9825,9857,9879,9881,9939,10002,10029,10038-10041,10070,10086,10093,10345,10347,10388,10407,10560-10562
/branches/nagvis-iframe:9764-9786
/branches/us168:8759,8762-8763,8766-8768,8770,8774-8777,8794,8798-8799,8801-8803,8821-8822,8834,8837-8838,8932,8937,8947,8969,8977,8981,9004,9007,9009-9010,9012,9024,9049
/commercial/branches/US306-slaves:9804-9823
/commercial/branches/US307-network-map:9685-9837

Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Root.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Root.pm	2012-10-22 12:53:06 UTC (rev 10563)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Root.pm	2012-10-22 12:57:18 UTC (rev 10564)
@@ -617,9 +617,10 @@
 
             # Force refresh_rate to 0 so no page refreshing
             $c->stash(
-                errors       => \@errors,
-                refresh_rate => 0,
-                template     => 'error'
+                errors             => \@errors,
+                refresh_rate       => 0,
+                disable_login_menu => 1,
+                template           => 'error'
             );
             $c->stash(
                 dokuwiki_link => Utils::Weberrors->lookup_errors( \@errors ) );

Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Testing.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Testing.pm	2012-10-22 12:53:06 UTC (rev 10563)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Testing.pm	2012-10-22 12:57:18 UTC (rev 10564)
@@ -22,6 +22,12 @@
 
 use base qw/Catalyst::Controller/;
 
+sub trigger_500 : Local : Descr('Trigger 500 Server Internal Error') {
+    my ( $self, $c ) = @_;
+
+    # template testing/trigger500 is missing
+}
+
 # generate links to all methods above
 sub index : Path : Args(0) {
     my ( $self, $c ) = @_;

Modified: trunk/opsview-web/lib/Opsview/Web.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web.pm	2012-10-22 12:53:06 UTC (rev 10563)
+++ trunk/opsview-web/lib/Opsview/Web.pm	2012-10-22 12:57:18 UTC (rev 10564)
@@ -531,6 +531,39 @@
     }
 }
 
+sub finalize_error {
+    my $c = shift;
+
+    $c->next::method(@_);
+
+    if ( !$c->debug && $c->res->status == 500 ) {
+        $c->res->body( <<'EOE' );
+<!DOCTYPE html
+    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
+<head>
+<title>Opsview Error</title>
+<link rel="stylesheet" type="text/css" href="" />
+<link rel="stylesheet" type="text/css" href="" />
+<link rel="stylesheet" type="text/css" href="" />
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+</head>
+<body>
+<div id="apache_error_page">
+<br><br>
+<img height="115" src="" id="login_logo" width="256" />
+<h3 class="mid">Opsview Apache Error:  500</h3><p class="mid">An internal error occurred</p>
+</div>
+</body>
+</html>
+                                                                               
+                                                                               
+                                                                               
+EOE
+    }
+}
+
 #
 # IMPORTANT: Please look into Opsview::Web::Controller::Root for more
 #

Modified: trunk/opsview-web/root/navmenu/megamenu
===================================================================
--- trunk/opsview-web/root/navmenu/megamenu	2012-10-22 12:53:06 UTC (rev 10563)
+++ trunk/opsview-web/root/navmenu/megamenu	2012-10-22 12:57:18 UTC (rev 10564)
@@ -113,26 +113,28 @@
         </div>
 
         [% END; # IF logged_in; %]
-        <div id="opsview_account_wrapper">
-            <div id="opsview_account_wrapper_menu" class="opsview_wrapper_menu opsview_menu_light_theme">
-                <ul class="opsview_menu opsview_menu_opsview">
-                    <li class="opsview_right"><a href="" c.uri_for( login_menu_header_url ).path | html %]" class="opsview_drop">[% login_menu_header %]</a>
-                        <div class="opsview_dropdown_1column opsview_align_right">
-                            [% IF logged_in -%]
-                                <p>[% login_message %]</p>
-                                [% IF asuser %]
-                                    <p>[% c.loc("ui.user.viewingAs [_1]", asuser.name) | html %]</p>
-                                [% END; # IF asuser %]
+        [% UNLESS disable_login_menu %]
+            <div id="opsview_account_wrapper">
+                <div id="opsview_account_wrapper_menu" class="opsview_wrapper_menu opsview_menu_light_theme">
+                    <ul class="opsview_menu opsview_menu_opsview">
+                        <li class="opsview_right"><a href="" c.uri_for( login_menu_header_url ).path | html %]" class="opsview_drop">[% login_menu_header %]</a>
+                            <div class="opsview_dropdown_1column opsview_align_right">
+                                [% IF logged_in -%]
+                                    <p>[% login_message %]</p>
+                                    [% IF asuser %]
+                                        <p>[% c.loc("ui.user.viewingAs [_1]", asuser.name) | html %]</p>
+                                    [% END; # IF asuser %]
 
-                              <p><a href="" c.uri_for("/logout").path | html %]" class="opsview_statusline">[% c.loc("ui.label.logout") | html %]</a></p>
-                            [% ELSE %]
-                              <p><a href="" c.uri_for("/login").path | html %]" class="opsview_statusline">[% c.loc("ui.label.login") | html %]</a></p>
-                            [%- END -%]
-                        </div>
-                    </li>
-                </ul>
+                                  <p><a href="" c.uri_for("/logout").path | html %]" class="opsview_statusline">[% c.loc("ui.label.logout") | html %]</a></p>
+                                [% ELSE %]
+                                  <p><a href="" c.uri_for("/login").path | html %]" class="opsview_statusline">[% c.loc("ui.label.login") | html %]</a></p>
+                                [%- END -%]
+                            </div>
+                        </li>
+                    </ul>
+                </div>
             </div>
-        </div>
+        [% END; # UNLESS disable_login_menu %]
     </div>
 [% IF logged_in && not disable_menu %]
     <div id="opsview_navigation_wrapper_menu" class="opsview_wrapper_menu opsview_menu_light_theme">

Copied: trunk/opsview-web/t/tests/Test/Opsview/Web/Testing.pm (from rev 10562, branches/enterprise/DEV-professional/opsview-web/t/tests/Test/Opsview/Web/Testing.pm)
===================================================================
--- trunk/opsview-web/t/tests/Test/Opsview/Web/Testing.pm	                        (rev 0)
+++ trunk/opsview-web/t/tests/Test/Opsview/Web/Testing.pm	2012-10-22 12:57:18 UTC (rev 10564)
@@ -0,0 +1,24 @@
+
+package Test::Opsview::Web::Testing;
+
+use strict;
+use warnings;
+use Test::More;
+
+use lib '/usr/local/nagios/t/lib';
+use base 'Test::Opsview::Web';
+
+sub trigger_500 : Test(2) {
+    my $self = shift;
+
+    $self->{mech}->get( "/testing/trigger_500" );
+
+    is( $self->{mech}->status, 500, "500 error was triggered" );
+    like(
+        $self->{mech}->content,
+        qr/An internal error occurred/,
+        "...and default error message was replaced"
+    );
+}
+
+1;

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to