The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #3142

Tagmail reporting barfs on call to Time.now.rfc2822()

Added by Josh Anderson over 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:02/02/2010
Priority:NormalDue date:
Assignee:James Turnbull% Done:

0%

Category:reportsEstimated time:1.00 hour
Target version:0.25.5
Affected Puppet version:0.25.4 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

After upgrading from 0.24.7 to 0.25.3, I noticed that I was no longer getting tagmail reports. My MTA logs were full of “Error reading SMTP packet” entries, so I started looking at tagmail.rb.

What I found is that tagmail is barfing on calling Time.now.rfc2822():

 smtp.open_message_stream(Puppet[:reportfrom], *emails) do |p|
   p.puts "From: #{Puppet[:reportfrom]}"
   p.puts "Subject: Puppet Report for %s" % self.host
   p.puts "To: " + emails.join(", ")
   p.puts "Date: " + Time.now.rfc2822        <----- NoMethodError here!
   p.puts
   p.puts messages
 end

The problem is that you can call Time.now() without a “require ‘time’” statement, but you can’t call Time.rfc2822() without first requiring the module.

You can see this if you run the following in irb:

>> Time.now
=> Tue Feb 02 15:41:29 -0800 2010
>> Time.now.rfc2822
NoMethodError: undefined method `rfc2822' for Tue Feb 02 15:41:34 -0800 2010:Time
    from (irb):2
>> require 'time'
=> true
>> Time.now.rfc2822
=> "Tue, 02 Feb 2010 15:42:00 -0800"
>> 

Because this happens after a fork(), no error messages are logged.

Adding a “require ‘time’” statement to tagmail.rb resolves this issue.

History

#1 Updated by James Turnbull over 4 years ago

  • Status changed from Unreviewed to Accepted
  • Assignee set to James Turnbull
  • Target version set to 0.25.5

#2 Updated by James Turnbull over 4 years ago

  • Status changed from Accepted to In Topic Branch Pending Review

#3 Updated by James Turnbull over 4 years ago

  • Status changed from In Topic Branch Pending Review to Closed

Pushed in commit:3457b876a104e6ae20d570cd4cf235881d869aaf in branch 0.25.x

Also available in: Atom PDF