Bug #2336
has_variable?("myclass:var") should return false, not error, if myclass has not been evaluated
| Status: | Closed | Start date: | 06/11/2009 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 0% |
||
| Category: | language | |||
| Target version: | 0.25.0 | |||
| Affected Puppet version: | 0.24.8 | Branch: | ||
| Keywords: | ||||
| Votes: | 0 |
Description
I’ve templates that conditionally print sections of a file like this
<% if has_variable?(“ssh:wants_firewall_rule”) %> -A INPUT -m state —state NEW -m tcp -p tcp —dport 22 -j ACCEPT <% end %>
then in the ssh class I just define
class ssh { $wants_firewall_rule = 1 #…… }
This works fine on nodes that ‘include ssh’ as planned. On classes that don’t, however, rather than has_variable?() evaluating to false, puppetd dies with the error:
[root@node03 ~]# puppetd -tv info: Retrieving plugins err: Could not retrieve catalog: Failed to parse template iptables/iptables.erb: Class ssh has not been evaluated so its variables cannot be referenced at /etc/puppet/modules/iptables/manifests/init.pp:11 on node node03.pixie warning: Not using cache on failed catalog
I don’t feel it’s an error for has_variable? to return false in this situation.
History
Updated by Luke Kanies over 2 years ago
- Category set to language
- Status changed from Unreviewed to Accepted
- Priority changed from High to Normal
- Target version set to 0.25.0
Updated by Luke Kanies over 2 years ago
- Status changed from Accepted to Ready For Checkin
- Assignee set to James Turnbull
Fixed in the tickets/master/2336 branch in my repo.
Updated by James Turnbull over 2 years ago
- Status changed from Ready For Checkin to Closed
Pushed in commit:e4ae870f6103aacbba48a06e366168aaaa67402b in branch master.