Issue #15496 has been updated by eric sorenson.
We implement yaml with zaml, and which incorrectly handles fractional negative tz offsets: <pre> lib/puppet/util/zaml.rb 375 class Time 376 def to_zaml(z) 377 # 2008-12-06 10:06:51.373758 -07:00 378 ms = ("%0.6f" % (usec * 1e-6))[2..-1] 379 offset = "%+0.2i:%0.2i" % [utc_offset / 3600, (utc_offset / 60) % 60] 380 z.emit(self.strftime("%Y-%m-%d %H:%M:%S.#{ms} #{offset}")) 381 end 382 end eric@glitch.local .../puppet/spec/unit/provider/package]% export TZ="America/Caracas" [eric@glitch.local .../puppet/spec/unit/provider/package]% irb irb(main):001:0> a = Time.now.utc_offset => -16200 irb(main):003:0> (a / 3600) => -5 </pre> Ruby is "helpfully" rounding down since the hours offset ends up with a remainder. If we coerce that result to a float it shows the actual result: <pre> irb(main):004:0> (a / 3600.0) => -4.5 </pre> And then the printf formatting works properly: <pre> irb(main):005:0> "%+0.2i" % (a / 3600.0) => "-04" </pre> So this diff fixes the problem: <pre> - offset = "%+0.2i:%0.2i" % [utc_offset / 3600, (utc_offset / 60) % 60] + offset = "%+0.2i:%0.2i" % [utc_offset / 3600.0, (utc_offset / 60) % 60] </pre> I have a branch up here if you want to try it out: https://github.com/ahpook/puppet/tree/15496-incorrect-zaml-utc-offset Andy asked for tests so I'll write some and turn it into a pull request after lunch. ---------------------------------------- Bug #15496: Puppet incorrectly determining offset for certain timezones https://projects.puppetlabs.com/issues/15496#change-78342 Author: Ken Johnson Status: Needs More Information Priority: Normal Assignee: eric sorenson Category: Target version: Affected Puppet version: Keywords: Branch: One of our customers reports this: "I believe I have just discovered a bug in PE's timezone handling that seems to impact at least reporting, but may be more widespread. We have a few systems in our environment that have their timezone set to "VET" - Venezuela Standard Time. The offset for VET is -04:30 all year round (no DST observance). If you run date -R and date -Ru on the systems it shows the correct time offset: # date -R ; date -uR Thu, 12 Jul 2012 11:45:30 -0430 Thu, 12 Jul 2012 16:15:30 +0000 However, I noticed that this group of systems was always listed first on the PE console and, more than that, their report time is always in the future. I have tried the PE console at both UTC and adjusted to display in US/Eastern. Doing some more digging, it appears that the problem is client-side during the Puppet report generation. If you look at the /var/opt/lib/pe-puppet/state/last_run_report.yaml file the offset reported is wrong: logs: - !ruby/object:Puppet::Util::Log level: !ruby/sym notice message: Finished catalog run in 0.07 seconds source: Puppet tags: - notice time: 2012-07-12 11:29:43.143028 -05:30 If Puppet (or Ruby) is determining the offset is incorrectly -05:30 instead of -04:30 I believe that this would account for the difference. The PE Console shows the run occuring at 16:59 UTC. However, /var/log/messages on the client concurs that the Puppet agent run ran at 11:29 local time (VET), which is the reported -5:30 offset, not the expected -4:30 offset. I am seeing the correct behavior for more common timezones such as US/Eastern, US/Pacific, etc. At the moment this appears limited only to systems in VET. The client systems in question are running PE 2.5.1 on RHEL 5.7, 64-bit. Thanks!" -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to puppet-bugs@googlegroups.com. To unsubscribe from this group, send email to puppet-bugs+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.