Please review pull request #535: (#7801) Modify include function to accept arrays opened by (eshamow)
Description:
When an array of classes is passed to the include() function, it
currently attempts to wrap the array in another array, and then pass the
entire array through as a single argument, causing an error. This
commit calls flatten against the array before sending it through,
following the pattern of realize(), and enabling arrays to be passed as
well as comma-separated or individual class values.
- Opened: Tue Feb 28 20:09:49 UTC 2012
- Based on: puppetlabs:master (e692c7ae5036f5703a46f4a3df6a47c34b5d761b)
- Requested merge: eshamow:tickets/master/7801_include_should_accept_arrays (a378ea0c10d297635ac173a16c2e632660adbb98)
Diff follows:
diff --git a/lib/puppet/parser/functions/include.rb b/lib/puppet/parser/functions/include.rb
index 1e12a6a..ae927f4 100644
--- a/lib/puppet/parser/functions/include.rb
+++ b/lib/puppet/parser/functions/include.rb
@@ -2,6 +2,9 @@
Puppet::Parser::Functions::newfunction(:include, :doc => "Evaluate one or more classes.") do |vals|
vals = [vals] unless vals.is_a?(Array)
+ #Protect against an array passed in being wrapped in another array
+ vals = vals.flatten
+
# The 'false' disables lazy evaluation.
klasses = compiler.evaluate_classes(vals, self, false)
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
