Bug #2471
Puppet.warning doesn't work with a hook in defaults.rb
| Status: | Code Insufficient | Start date: | 07/30/2009 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | plumbing | |||
| Target version: | 2.7.x | |||
| Affected Puppet version: | 0.25.0 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
If you try to add a Puppet.warning to a hook in defaults.rb, like:
:reportserver => {
:default => "$server",
:desc => "(Deprecated) The server to which to send transaction reports.",
:call_on_define => true,
:hook => proc { |value|
if value
$stderr.puts "This works"
Puppet.warning "This will not."
Puppet.settings[:report_server] = value
end
}
},
you get:
/Library/Ruby/Site/1.8/puppet/util/log.rb:517:in `source=': uninitialized constant Puppet::Type (NameError)
I notice :cacrl is using a Puppet.warning in a hook and is subject to the same issue.
History
Updated by Luke Kanies almost 3 years ago
- Status changed from Unreviewed to Accepted
- Priority changed from Normal to Low
- 3 changed from Unknown to Easy
Not surprising, probably an easy fix but probably not quite worth getting into 0.25.
Updated by Luke Kanies almost 3 years ago
- Category set to plumbing
- Status changed from Accepted to In Topic Branch Pending Review
- Assignee set to Nigel Kersten
- Target version set to 0.25.0
I’ve published what I think is a fix in the tickets/master/2471 branch in my repo.
Nigel, can you test this and verify it works? If it doesn’t, can you provide some more detail?
Updated by Nigel Kersten almost 3 years ago
- Assignee deleted (
Nigel Kersten) - Target version changed from 0.25.0 to 2.6.0
- 3 changed from Easy to Unknown
This doesn’t work as we haven’t set up any log destinations.
I started to set this up, but then ran into issues where the deprecation warning was being displayed on code as simple as:
require 'puppet' puts Puppet.version
so for my particular case have given up and am marking as deprecated in the genconfig output/documentation.
Unassigning, bumping to 0.26.0
Updated by James Turnbull over 2 years ago
- Status changed from In Topic Branch Pending Review to Code Insufficient
Updated by James Turnbull over 2 years ago
- Target version changed from 2.6.0 to 2.7.x
Updated by Luke Kanies 10 months ago
- File 2471.patch added
I’ve attached the patch I wrote oh so long ago – it’s very small, and could easily be applied if deemed appropriate.
I’m deleting my branch, since it didn’t quite suffice.