diff options
author | Luke Kanies <luke@madstop.com> | 2009-09-19 21:56:05 -0700 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-09-22 09:27:23 +1000 |
commit | af57483e618ace39c0d4540fd0f8479f5430f0ef (patch) | |
tree | d9ddab25529e482bb715e9b799b519169f5cb127 /lib/puppet/parser/functions/require.rb | |
parent | d42bda1f22e3beca321700a78aab9c1399537c30 (diff) | |
download | puppet-af57483e618ace39c0d4540fd0f8479f5430f0ef.tar.gz puppet-af57483e618ace39c0d4540fd0f8479f5430f0ef.tar.xz puppet-af57483e618ace39c0d4540fd0f8479f5430f0ef.zip |
Fixing #2632 - 'require' works for 0.25 clients
I couldn't find a way to make it compatible with
earlier clients, so the docs specify that
it doesn't work with them, and it helpfully fails.
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/parser/functions/require.rb')
-rw-r--r-- | lib/puppet/parser/functions/require.rb | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/require.rb b/lib/puppet/parser/functions/require.rb index 7d73831b8..3a2032d7f 100644 --- a/lib/puppet/parser/functions/require.rb +++ b/lib/puppet/parser/functions/require.rb @@ -23,12 +23,24 @@ class depends on the required class. file { '/foo': notify => Service[foo] } } +Note that this function only works with clients 0.25 and later, and it will +fail if used with earlier clients. + ") do |vals| - send(:function_include, vals) + send(:function_include, vals) + if resource.metaparam_compatibility_mode? + warning "The 'require' function is only compatible with clients at 0.25 and above; including class but not adding dependency" + else vals = [vals] unless vals.is_a?(Array) - # add a relation from ourselves to each required klass vals.each do |klass| - compiler.catalog.add_edge(resource, findresource(:class, klass)) + # This is a bit hackish, in some ways, but it's the only way + # to configure a dependency that will make it to the client. + # The 'obvious' way is just to add an edge in the catalog, + # but that is considered a containment edge, not a dependency + # edge, so it usually gets lost on the client. + ref = Puppet::Parser::Resource::Reference.new(:type => :class, :title => klass) + resource.set_parameter(:require, ref) end + end end |