Bug #3845
Resources do not inherit class-level tags
| Status: | Accepted | Start date: | 05/21/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | tags | |||
| Target version: | - | |||
| Affected Puppet version: | 0.25.4 | Branch: | ||
| Keywords: | ||||
| Votes: | 1 |
Description
Resources (and virtual resources) are not having their classes declared tags correctly applied. (“Add the specified tags to the containing class or definition. All contained objects will then acquire that tag, also.” ref: http://docs.puppetlabs.com/references/latest/function.html#tag)
class foo {
tag 'notworking'
notify { "I'm untagged": }
notify { "I'm tagged": tag => "notworking" }
}
include foo
Notify <| tag == "notworking" |> { message => "I am though" }
Results in:
mauve /home/jbooth > puppet tagmagic.pp notice: I am though notice: //foo/Notify[I'm tagged]/message: defined 'message' as 'I am though' notice: I'm untagged notice: //foo/Notify[I'm untagged]/message: defined 'message' as 'I'm untagged'
You can change the ‘tag == “foo”’ and life doesn’t get any better. The neither notify gets the message changed.
mauve /home/jbooth > tail -1 tagmagic.pp
Notify <| tag == "foo" |> { message => "I am though" }
mauve /home/jbooth > puppet tagmagic.pp
notice: I'm untagged
notice: //foo/Notify[I'm untagged]/message: defined 'message' as 'I'm untagged'
notice: I'm tagged
notice: //foo/Notify[I'm tagged]/message: defined 'message' as 'I'm tagged'
Related issues
History
Updated by James Turnbull almost 2 years ago
- Category set to tags
- Status changed from Unreviewed to Accepted
- Assignee set to Matt Robinson
Yep – looks like a problem.
Updated by Marco Marongiu almost 2 years ago
I have a similar problem
In a class, I have this:
if tagged(release) {
exec{"sync_puppetconf":
cwd => '/',
path => '/usr/bin',
command => "rsync -zav --delete $syncserver::$syncconfmod $syncconfpath"
}
}
Anyway, if I run puppetd —test —tags release (be it with or without —test), I don’t get the rsync run. It doesn’t run also without the “—tags release”, but that is expected.
Using 0.25.4 from the backports archive on Debian Lenny.
Updated by Matt Robinson over 1 year ago
- Assignee deleted (
Matt Robinson)
I’m not working on this so unassigning.
Updated by Ryan McKern over 1 year ago
Any one taken a look at this since it was unassigned?
Updated by Matt Robinson over 1 year ago
No, it hasn’t been looked at since it was unassigned. We do welcome patches though. Does this problem still exist on our new 2.6.x branch?
Updated by Ryan McKern over 1 year ago
Apologies for the delay, but this was the first chance I had to circle back around to this. Yes, it appears that the problem still persists in the 2.6.x branch, judging by our own node configuration as well as the test code. With puppet 0.25.1, the behavior of the above tagmagic.pp file is:
[ryan@somehost ~]# puppet tagmagic.pp
notice: I am though
notice: //foo/Notify[I'm tagged]/message: defined 'message' as 'I am though'
notice: I'm untagged
notice: //foo/Notify[I'm untagged]/message: defined 'message' as 'I'm untagged'
But using puppet 2.6.2 I receive:
[ryan@anotherhost ~]# puppet tagmagic.pp
notice: I'm untagged
notice: /Stage[main]/Foo/Notify[I'm untagged]/message: defined 'message' as 'I'm untagged'
notice: I am though
notice: /Stage[main]/Foo/Notify[I'm tagged]/message: defined 'message' as 'I am though'
—
As I’m a novice script writer at best (being primarily an operations admin) I’m not even sure where to start digging into this. This is blocking our migration to 2.6.x from 0.25.1 as we make heavy use of tags in both node and class definitions. Even a suggestion as to where to start digging into this would be incredibly helpful.
Looks like this is addressed in a newer bug fix here: http://projects.puppetlabs.com/issues/4631
Updated by Nigel Kersten over 1 year ago
- Status changed from Accepted to Needs More Information
- Assignee set to Nigel Kersten
Ryan, just so we can be sure that class level tags from the tag function are addressed by the fix in #4631 for implicit tags, have you had a chance to test the fix from that ticket?
Updated by Ryan McKern over 1 year ago
Hi Nigel, It looks like the fix from #4631 was rolled into 2.6.2; I’m still seeing this problem (with the same code and output as above) though.
Updated by Nigel Kersten over 1 year ago
- Status changed from Needs More Information to Accepted
- Assignee deleted (
Nigel Kersten)