Bug #6696
tag metaparam not working
| Status: | Needs Decision | Start date: | 03/14/2011 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% | ||
| Category: | tags | |||
| Target version: | - | |||
| Affected Puppet version: | 2.6.6 | Branch: | ||
| Keywords: | ||||
Description
Given a manifest:
class test {
tag("bob")
file { "/tmp/test":
ensure => present,
content => template('/tmp/filet'),
tag => "files",
}
}
include test
With the template:
<% tags.each do |tag| -%> The tag <%= tag %> is part of the current scope <% end -%> <% all_tags.each do |tag| -%> The tag <%= tag %> is defined <% end -%>
When I run either:
puppet --tags files /tmp/file.pp
or:
puppet /tmp/file.pp
I get:
The tag class is part of the current scope The tag test is part of the current scope The tag bob is part of the current scope The tag settings is defined The tag class is defined The tag test is defined
No sign of the tag “files” anywhere.
Related issues
History
#1
Updated by Nigel Kersten over 2 years ago
- Status changed from Needs Decision to Needs More Information
Can you confirm whether the tags end up actually working? e.g. whether it’s a bug in tags/all_tags or tags themselves aren’t functional?
#2
Updated by James Turnbull over 2 years ago
- Status changed from Needs More Information to Needs Decision
Think I’ve already indicated that – tags returns “bob” with the function but not “files” which means it’s returning all the tags in scope. The code for tags and all_tags is incredibly simple:
# Allow templates to access the tags defined in the current scope
def tags
scope.tags
end
# Allow templates to access the all the defined tags
def all_tags
scope.catalog.tags
end
#3
Updated by Nigel Kersten over 2 years ago
James Turnbull wrote:
Think I’ve already indicated that – tags returns “bob” with the function but not “files” which means it’s returning all the tags in scope. The code for tags and all_tags is incredibly simple:
No, I think you missed what I was saying.
Take this simpler manifest
class test {
file { "/tmp/foo":
ensure => file,
content => "foo",
tag => "files",
}
}
include test
kripke:~ nbk$ rm -f /tmp/foo; puppet -v --tags notfiles /tmp/test.pp
info: Applying configuration version '1300152210'
kripke:~ nbk$ rm -f /tmp/foo; puppet -v --tags files /tmp/test.pp
info: Applying configuration version '1300152215'
notice: /Stage[main]/Test/File[/tmp/foo]/ensure: defined content as '{md5}acbd18db4cc2f85cedef654fccc4a4d8'
The metaparam is functional. There’s an issue with the tags/all_tags functions or ordering or something going on.
#4
Updated by Nigel Kersten 12 months ago
- Assignee changed from Nigel Kersten to eric sorenson
#5
Updated by Fabrice Bacchella 7 months ago
I just hit the same bug with version 3.0.1.