Bug #3142
Tagmail reporting barfs on call to Time.now.rfc2822()
| Status: | Closed | Start: | 02/02/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | reports | |||
| Target version: | 0.25.5 | Estimated time: | 1.00 hour | |
| Affected version: | 0.25.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
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
Updated by James Turnbull 7 months ago
- Status changed from Unreviewed to Accepted
- Assignee set to James Turnbull
- Target version set to 0.25.5
Updated by James Turnbull 7 months ago
- Status changed from Accepted to Ready for Testing
Updated by James Turnbull 7 months ago
- Status changed from Ready for Testing to Closed
Pushed in commit:“3457b876a104e6ae20d570cd4cf235881d869aaf” in branch 0.25.x