Bug 490524 - Perl pages don't work in CET time zone
Perl pages don't work in CET time zone
Status: CLOSED ERRATA
Product: Red Hat Satellite 5
Classification: Red Hat
Component: WebUI (Show other bugs)
530
All Linux
medium Severity high
: ---
: ---
Assigned To: Jan Pazdziora
Martin Minar
: Triaged
Depends On:
Blocks: 819027
  Show dependency treegraph
 
Reported: 2009-03-16 16:12 EDT by Jay Dobies
Modified: 2016-07-03 20:54 EDT (History)
6 users (show)

See Also:
Fixed In Version: spacewalk-web-1.7.28-31
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-11-26 02:46:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jay Dobies 2009-03-16 16:12:59 EDT
Description of problem:
Spun off from bz484686. The example given in that bz is:

Additionally: if I try to access scout list I get:
==> /var/log/httpd/error_log <==
[Tue Feb 10 15:59:34 2009] [error] Execution of
/var/www/html/network/monitoring/scout/index.pxt failed at Tue Feb 10 15:59:34
2009: Cannot determine local time zone
[Tue Feb 10 15:59:35 2009] [error] Traceback sent to msuchy@redhat.com at
/usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm line 729.  

Version-Release number of selected component (if applicable):
5.3

How reproducible:
Always

Steps to Reproduce:
1. Configure the server's time zone to be CET (server itself, not the preferences for Satellite)
2. Restart Satellite after changing the server's time zone
3. Attempt to access /var/www/html/network/monitoring/scout/index.pxt
  
Actual results:
[Tue Feb 10 15:59:34 2009] [error] Execution of
/var/www/html/network/monitoring/scout/index.pxt failed at Tue Feb 10 15:59:34
2009: Cannot determine local time zone

Expected results:
Page is displayed correctly (this occurs, for instance, when the server is set to EST).

Additional info:
I'm not fully sure if this is all perl pages or just the monitoring pages. I did some quick looking but didn't immediately see what in the perl code was triggering this, so I can't say for sure how many pages are affected.
Comment 12 Jan Pazdziora 2012-11-08 11:26:39 EST
Note about reproducing -- a push has to be initiated to see the issue. If you just enable monitoring and scount, the page

/network/monitoring/scout/index.pxt

loads OK.
Comment 13 Jan Pazdziora 2012-11-08 11:29:43 EST
The full traceback is:

[Thu Nov 08 17:28:21 2012] [error] Execution of /var/www/html/network/monitoring/scout/index.pxt failed at Thu Nov  8 17:28:21 2012: Cannot determine local time zone
 at /usr/lib/perl5/site_perl/5.8.8/DateTime/TimeZone/Local.pm line 27
	DateTime::TimeZone::Local::local_time_zone() called at /usr/lib/perl5/site_perl/5.8.8/DateTime/TimeZone.pm line 54
	DateTime::TimeZone::new('undef', 'name', 'local') called at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DateTime.pm line 1523
	DateTime::set_time_zone('DateTime=HASH(0x2ad35616bfb0)', 'local') called at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DateTime.pm line 451
	DateTime::from_epoch('undef', 'epoch', 1352391915, 'time_zone', 'local') called at /usr/lib/perl5/vendor_perl/5.8.8/RHN/Date.pm line 65
	RHN::Date::new('undef', 'string', '2012-11-08 17:25:15', 'user', 'RHN::User=HASH(0x2ad354e376c0)') called at /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB/User.pm line 428
	RHN::DB::User::convert_time('RHN::User=HASH(0x2ad354e376c0)', '2012-11-08 17:25:15', '0.000000 %r %Z') called at /usr/lib/perl5/vendor_perl/5.8.8/Sniglets/ListView/ScoutList.pm line 65
	Sniglets::ListView::ScoutList::row_callback('Sniglets::ListView::ScoutList=HASH(0x2ad355bda440)', 'HASH(0x2ad355bede60)', 'PXT::Request=HASH(0x2ad337abf7d0)') called at /usr/lib/perl5/vendor_perl/5.8.8/Sniglets/ListView/List.pm line 1017
	Sniglets::ListView::List::render('Sniglets::ListView::ScoutList=HASH(0x2ad355bda440)', 'PXT::Request=HASH(0x2ad337abf7d0)') called at /usr/lib/perl5/vendor_perl/5.8.8/Sniglets/Lists.pm line 119
	Sniglets::Lists::listview('PXT::Request=HASH(0x2ad337abf7d0)', 'mode', 'scouts_all', 'class', 'Sniglets::ListView::ScoutList', '__block__', '\\x{a}    <formvars>\\x{a}      <var name="set_label" type="literal">sc...') called at /usr/lib/perl5/vendor_perl/5.8.8/PXT/Parser.pm line 160
	PXT::Parser::expand_tag('PXT::Parser=HASH(0x2ad354fd9570)', 'rhn-listview', 'CODE(0x2ad355ba6700)', 'SCALAR(0x2ad349022870)', 'PXT::Request=HASH(0x2ad337abf7d0)') called at /usr/lib/perl5/vendor_perl/5.8.8/PXT/Parser.pm line 72
	PXT::Parser::expand_tags('PXT::Parser=HASH(0x2ad354fd9570)', 'SCALAR(0x2ad349022870)', 'PXT::Request=HASH(0x2ad337abf7d0)') called at /usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm line 489
	PXT::ApacheHandler::pxt_parse_data('PXT::ApacheHandler', 'PXT::Request=HASH(0x2ad337abf7d0)', 'SCALAR(0x2ad349022870)') called at /usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm line 103
	eval {...} called at /usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm line 103
	PXT::ApacheHandler::handler('Apache2::RequestRec=SCALAR(0x2ad355063fb0)') called at -e line 0
	eval {...} called at -e line 0
[Thu Nov 08 17:28:21 2012] [error] Traceback sent to root@localhost at /usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm line 563.
Comment 14 Jan Pazdziora 2012-11-08 14:36:14 EST
Patch for the scout/index.pxt page:

diff --git a/web/modules/rhn/RHN/Date.pm b/web/modules/rhn/RHN/Date.pm
index 5df2daa..ebef623 100644
--- a/web/modules/rhn/RHN/Date.pm
+++ b/web/modules/rhn/RHN/Date.pm
@@ -34,6 +34,11 @@ sub new {
   my $class = shift;
   my %params = validate(@_, { -now => 0, -epoch => 0, -string => 0, -user => 0, from_zone => 0, source => 0 });
 
+  my $time_zone = 'local';
+  if ($params{user}) {
+    $time_zone = $params{user}->get_timezone;
+  }
+
   my $dt;
   if (exists $params{source}) {
     my $from = $params{source};
@@ -50,19 +55,19 @@ sub new {
     $dt = $from->clone;
   }
   elsif (exists $params{now}) {
-    $dt = DateTime->now(time_zone => "local");
+    $dt = DateTime->now(time_zone => $time_zone);
   }
   elsif (exists $params{epoch}) {
-    $dt = DateTime->from_epoch(epoch => $params{epoch}, time_zone => "local");
+    $dt = DateTime->from_epoch(epoch => $params{epoch}, time_zone => $time_zone);
   }
   elsif (exists $params{string}) {
     my $from_zone = $params{from_zone};
     if ($from_zone) {
       $dt = DateTime->from_epoch(epoch => date_to_epoch($params{string}, $from_zone),
-                                time_zone => "local");
+                                time_zone => $time_zone);
     }
     else {
-      $dt = DateTime->from_epoch(epoch => str2time($params{string}), time_zone => "local");
+      $dt = DateTime->from_epoch(epoch => str2time($params{string}), time_zone => $time_zone);
     }
   }
   else {
@@ -71,10 +76,6 @@ sub new {
 
   my $self = bless { dt => $dt }, $class;
 
-  if ($params{user}) {
-    $self->time_zone($params{user}->get_timezone);
-  }
-
   return $self;
 }
Comment 15 Jan Pazdziora 2012-11-08 14:51:36 EST
Another page that needs to be fixed is

/network/systems/details/history/snapshots/rollback.pxt

I have a fix. I believe that we will be able to change the Perl code to avoid using DateTime's time_zone local altogether.
Comment 16 Jan Pazdziora 2012-11-09 07:02:44 EST
Making bugzilla public, taking.
Comment 17 Jan Pazdziora 2012-11-09 08:48:19 EST
Fixed in Spacewalk master, 9a6c6950d8d66f61d6f07ad60bcaa9ed020d2e31, 5a0049556ca3b8a9fbaca979b1f659a26d4299a3, 75fe42d376b34c0a0cef0e7371b510346ec721a6, 108d293dd49cd20a8cc18fc47cde762ca258f6e9
Comment 23 errata-xmlrpc 2012-11-26 02:46:37 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-1486.html

Note You need to log in before you can comment on or make changes to this bug.